Set Up Your Project

Setting up your project entails adding the code used to load and configure the BindID SDK, as described below.

STEP 1: Load the SDK

Load the BindID SDK using the following URL based on the environment:

  • Sandbox:

    https://signin.bindid-sandbox.io/bindid-sdk/transmit-bind-id-sdk.js
  • Production:

    https://signin.bindid.io/bindid-sdk/transmit-bind-id-sdk.js

Typically, this is done by adding the following script tags to your page, where the first script tag is used to support polyfilling for IE browsers and the second is used to load the SDK:

<script src="https://polyfill.io/v3/polyfill.min.js?features=Promise%2CPromise.prototype.finally%2CTextDecoder%2CTextEncoder%2CObject.entries"></script>
<script src="<sdk-url>" defer></script>

where <sdk-url> is the URL provided above.

STEP 2: Configure the SDK

The BindID SDK can be initialized and configured in two ways—either using meta tags or programatically.

Using Meta Tags

To configure the SDK using tags:

Add the following set of meta tags before the script tag used to load the SDK:

Meta NameDescription
xm-bind-id-client_idClient identifier issued to the client via the BindID Admin Portal. Equivalent to the clientId parameter of the initialize() SDK call.
xm-bind-id-api_compatOptional. API compatibility level. Options are: latest—most updated API level, and api-level-1—first API level. Equivalent to the apiCompat parameter of the initialize() SDK call.
xm-bind-id-disable_state_validationOptional. Whether or not the processRedirectResponse() method should validate the last state sent with the last authenticate() call. Options are: true—state is not validated, and false—(default) state is validated. Equivalent to the disableStateValidation parameter of the initialize() SDK call.

For example:

<meta name="xm-bind-id-client_id" content="qL4IJvJ1kHwunrLNOGhAAVCMD39EDPWF">
<meta name="xm-bind-id-api_compat" content="latest">
<meta name="xm-bind-id-disable_state_validation" content="false">

Using SDK Calls

To configure the SDK programatically:

Invoke the initialize() SDK method (see the API reference).

Here's an example of invoking the initialize() SDK method:

function initializeSDK() {
window.XmBindId.initialize({
clientId: 'qL4IJvJ1kHwunrLNOGhAAVCMD39EDPWF',
apiCompat: window.XmBindId.XmBindIdApiCompatibilityLevel.UseLatest
}).then(res => {
alert('SDK Initialized');
});
}