To use our web integration, you must generate a web token for every instance of the widget you run. You can generate a token with this library by editing the sample code below with your own parameters:
constsmileIdentityCore=require("smile-identity-core");constWebApi=smileIdentityCore.WebApi;// Initializelet partner_id ="<Put your partner ID here>"; // login to the Smile ID portal to view your partner idlet default_callback ="<Put your default callback url here>";let api_key ="<Put your API key here>"; // copy your API key from the Smile ID portallet sid_server ="<0 | 1>"; // Use '0' for the sandbox server, use '1' for production serverconstconnection=newWebApi( partner_id, default_callback, api_key, sid_server,);// Create required request parameterslet request_params = { user_id:"<put your unique ID for the user here>", job_id:"<put your unique job ID here>", product:"<put product name here>",// Choose one of 'authentication', 'basic_kyc', 'smartselfie', 'biometric_kyc', 'enhanced_kyc', 'doc_verification' callback_url:"<Put your default callback url here>",// Optional if callback url was set during initialization of the class};// Generate the web token// This method returns a promiseresponse =connection.get_web_token(request_params);
Response
The response will return a hash that contains the following:
{
"success":true,
"token":"<token string>"
}
For a comprehensive guide on using the web integration, check the Usage section of the Web Integration documentation.