Skip to content

Commit

Permalink
bring back jsfiddle (#2198)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonfido authored Feb 6, 2024
1 parent 40f82ee commit 9ba27b6
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions demo/fiddle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This folder is here to allow JSFiddle to be automatically created using this repo.

You can [view the JSFiddle here](https://jsfiddle.net/gh/get/library/pure/onfido/onfido-sdk-ui/tree/master/demo/fiddle/).
Empty file added demo/fiddle/demo.css
Empty file.
7 changes: 7 additions & 0 deletions demo/fiddle/demo.details
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: Onfido SDK Demo
authors:
- Onfido Team
resources:
- https://sdk.onfido.com/v14/Onfido.iife.js
...
Empty file added demo/fiddle/demo.html
Empty file.
23 changes: 23 additions & 0 deletions demo/fiddle/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const getToken = async () => {
const response = await fetch('https://token-factory.onfido.com/sdk_token');
if (!response.ok) {
throw new Error('Failed to get sdk token');
}

return (await response.json()).message;
}

async function bootstrapSdk() {

Onfido.init({
useModal: false,
token: await getToken(),
onComplete: (data) => {
console.log('completed', data);
},
onError: console.error,
steps: ['welcome', 'document', 'face', 'complete'],
});
}

bootstrapSdk().catch(console.error);

0 comments on commit 9ba27b6

Please sign in to comment.