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 information:
importsmile.identity.core.WebApi;importsmile.identity.core.enums.Product;// InitializeString partnerId ="<Put your partner ID here>"; // login to the Smile ID portal to view your partner IDString defaultCallback ="<Put your default callback URL here>";String apiKey ="<Put your API key here>"; // copy your API key from the Smile ID portalString sidServer ="<0 | 1>"; // Use '0' for the sandbox server, use '1' for the production serverWebApi connection =newWebApi(partnerId, apiKey, defaultCallback, sidServer);String userId ="<Put your unique ID for the user here>";String jobId ="<Put your unique job ID here>";Product product =Product.AUTHENTICATION; // Product enum of product names (AUTHENTICATION, BASIC_KYC, SMARTSELFIE, BIOMETRIC_KYC, ENHANCED_KYC, DOC_VERIFICATION, EKYC_SMART_SELFIE, IDENTITY_VERIFICATION)String callbackUrl ="<Put your callback URL here>"; // Optional if callback URL was set during initialization// Generate the web tokenString timestamp =Instant.now().toString();String token =connection.getWebToken(timestamp, userId, jobId, product, callbackUrl);// You can also call the method without passing in a callbackUrlString token =connection.getWebToken(timestamp, userId, jobId, product);