Skip to content


In order to make a fast PoC you can copy and paste the following code. We assume that the fast PoC will be a vanilla HTML/JavaScript page. You will need the trial token that you can find on the Credentials section of the Dashboard

1. Web SDK PoC code

<!DOCTYPE html>

<html lang="en">

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>Alice Onboarding: POC</title>

    <!-- Import the Alice Web SDK library -->
    <script src=""></script>

    <!-- Import the Alice Web SDK CSS styles -->
    <link rel="stylesheet" href="" />

    <style type="text/css">
        .info-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            font-family: "Nunito", sans-serif;
            padding: 1rem;

        // It is necessary to use an event to initialize the Onboarding
        window.onload = () => {

        // Declare a function to wrap all Alice Onboarding code
        async function startOnboarding() {
            // The following code will configure your Onboarding

            // Add your trial token -> you can find it in the Credentials section of your Dashboard (Sandbox Dashboard)
            let trialToken = "";
            // Is mandatory to use an email in order to identify your user in this fast POC (Trial Authentication requirement)
            let email = "";

            // The user will be able to choose the issuing country of the document
            let issuingCountry = "SELECT";

            // You can set a specific nationality for the required document.
            // let issuingCountry = "ESP";

            //If you are using the .AnyDocument feature you will be able to select which types of documents are accepted:
            let acceptedDocumentTypes = [aliceonboarding.DocumentType.IDCARD, aliceonboarding.DocumentType.RESIDENCEPERMIT, aliceonboarding.DocumentType.   DRIVERLICENSE, aliceonboarding.DocumentType.PASSPORT];

            // Define your capture configuration parameters:
            let documentStageConfig = new aliceonboarding.DocumentStageConfig({
                capturerType: aliceonboarding.DocumentCapturerType.CAMERA,
                automaticCapture: true

            // This class MUST only be used for a POC against the sandbox environment.
            // In the production environment you MUST implement the authentication mechanism in your backend (see: [    sections/alice_integration/authentication/](
            // "sandbox" string configures the environment for the trial authenticator method.
            let authenticator = new aliceonboarding.TrialAuthenticator({
                sandboxToken: trialToken,
                userInfo: {
                environment: "sandbox"

            // Initialize your SDK to use the Sandbox Environment

            // Callbacks that will be called after the user completes their onboarding

            // This one is called when the user successfully completes the onboarding
            // The userInfo object contains a brief summary about the user. Retrieving
            // the complete information about the user is a backend operation
            function onSuccess(userInfo) {
                console.log("onSuccess: " + userInfo);

            // This one is called when an error happens during the onboarding
            function onFailure(error) {
                console.log("onFailure: " + error);

            // This one is called when the user exits the onboarding process without
            // completing it
            function onCancel() {

            try {
                let userToken = "";
                try {
                    // Here we use the authenticator to retrieve the user token
                    userToken = await authenticator.execute();
                } catch (e) {
                    if (e.code === 500 || e.code === 401) {
                        // The following alert will be displayed if you are using an incorrect Trial Token.
                            "Make sure you are using the trial token of your Sandbox credentials, you can find it in your Alice Dashboard. https://dashboard.sandbox."
                    } else console.log(e);

                // Initialize the Onboarding configuration
                let config = new aliceonboarding.OnboardingConfig()
                    // You must define each of the steps needed to complete the Onboarding.
                    // The user will have to complete all them in order to complete the Onboarding.

                    // Token obtained with TrialAuthenticator class only in trial environment.

                    // The following Step will require a Selfie to the User.

                    // The following Step configures the automatic capture for any document contained in the acceptedDocumentTypes array/list if it's supported by    Alice. The document will be detected automatically if it's a document from Spain or France.
                    .withAddAnyDocumentStage({ allowedTypes: acceptedDocumentTypes })

                    // The following Step configures the automatic capture for an IdCard
                        documentType: aliceonboarding.DocumentType.IDCARD,

                    // The following Step configures the automatic capture for a Residence Permit
                        documentType: aliceonboarding.DocumentType.RESIDENCEPERMIT,

                    // The following Step configures the automatic capture for a Driving License
                        documentType: aliceonboarding.DocumentType.DRIVERLICENSE,

                    // The following Step configures the automatic capture for any supported Passport.
                        documentType: aliceonboarding.DocumentType.PASSPORT,

                // Define the id from the component where the onboarding will be displayed.
                // In this example the div has "alice-onboarding-mount" as id.
                let onboarding = new aliceonboarding.Onboarding({
                    idSelector: "alice-onboarding-mount",
                    onboardingConfig: config

                // Run the Onboarding with the previously configured parameters
                // The Onboarding will call one of the defined callbacks
      , onFailure, onCancel);
            } catch (e) {
                // The following alert will show you any kind of error in the initializing proccess.
                alert(e); // Remember not to include it in your production page.


    <div class="info-container">
        <h1>Alice Web SDK POC</h1>

            If you don't have your Trial Token, please
            <a href="" target="_blank">access your
            and get it
        <div>The Alice Web SDK should be displayed under this div</div>

    <!-- Is mandatory to have an "empty div" with an id where the onboarding will be displayed -->
    <div id="alice-onboarding-mount"></div>