Skip to main content

Example

Redirect

This example will redirect to our page:

import Facenote from '@facenote/webapp-sdk'

const CLIENT_ID = <YOUR_CLIENT_ID>
const CLIENT_SECRET = <YOUR_CLIENT_SECRET>
const DEVICE_ID = <YOUR_DEVICE_ID>

const facenote = new Facenote()
await facenote.initialize(CLIENT_ID, CLIENT_SECRET, DEVICE_ID)

const userId = "user-unique-id"
const callbackUrl = <YOUR_CALLBACK_URL>
const options = {
language: 'en',
eventData: {},
walletPublicKey: 'SOME WALLET PUBLIC KEY',
trackingId: 'your-tracking-id'
}

facenote.onboarding(userId, callbackUrl, options)

Iframe

This example will use the embebbed iframe called example-iframe:

Example using URL Callback

import Facenote from '@facenote/webapp-sdk'

const CLIENT_ID = <YOUR_CLIENT_ID>
const CLIENT_SECRET = <YOUR_CLIENT_SECRET>
const DEVICE_ID = <YOUR_DEVICE_ID>

const facenote = new Facenote()
await facenote.initialize(CLIENT_ID, CLIENT_SECRET, DEVICE_ID)

const userId = "user-unique-id"
const callbackUrl = <YOUR_CALLBACK_URL>
const options = {
language: 'en',
iframe: document.getElementById("example-iframe"),
eventData: {},
walletPublicKey: 'SOME WALLET PUBLIC KEY',
trackingId: 'your-tracking-id'
}

facenote.onboarding(userId, callbackUrl, options)

Example using Function Callback

import Facenote from '@facenote/webapp-sdk'

const CLIENT_ID = <YOUR_CLIENT_ID>
const CLIENT_SECRET = <YOUR_CLIENT_SECRET>
const DEVICE_ID = <YOUR_DEVICE_ID>

const facenote = new Facenote()
await facenote.initialize(CLIENT_ID, CLIENT_SECRET, DEVICE_ID)

const userName = "User Name"
const userId = "user-unique-id"
const callbackUrl = undefined
const functionCallback = (result) => {
// Do something
}
const options = {
language: 'en',
iframe: document.getElementById("example-iframe"),
eventData: {},
walletPublicKey: 'SOME WALLET PUBLIC KEY',
trackingId: 'your-tracking-id'
}

facenote.onboarding(userId, callbackUrl, options, functionCallback)