Skip to main content

Process Flow

Access Token Request

Token request received from the end-user is assessed on specific parameters (discussed below):

  • Identify Client ID & Client Secret Key.
  • Check the authenticity of client’s credentials.
  • Read client’s data.
  • Response is sent back after generating access token.

Request Parameters


ParametersDescription
webhook_urlRequired: Yes
Type: string
This allows the Client to receive response of request, either success or fail.
languageRequired: No
Type: string
Length: 2 characters
If the Shufti Pro client wants their preferred language to appear on the authentication screens they may provide the 2-character long language code of their preferred language. The list of Supported Languages can be consulted for the language codes. If this key is missing in the request the system will select the default language as English.
referenceRequired: Yes
Type: string
Minimum: 6 characters
Maximum: 64 characters
Each request has a unique Reference ID which is sent back to Client against each response. The Client can use the Reference ID to check status of each verification.
request_typeRequired: Yes
Type: string
This parameter decides the type of verification you want to perform.
Note: Use "enroll" as the value for request_type if you want end-user to sign-up, or "authenticate" if you want end-user to sign-in.
documentRequired: No
Type: boolean
This option decides if End-User’s ID document is validated or not. Give value 1 if you want to validate the ID document, or 0 if you want to skip it.
phoneRequired: No
Type: boolean
This option decides if End-User’s phone number is validated or not. Give value 1 if you want to validate the phone number, or 0 if you want to skip it.
questionRequired: No
Type: boolean
This option decides if the end-users asked for security questions or not. Give value 1 if you want to validate security questions, or 0 if you want to skip it.
emailRequired: No
Type: string
Minimum: 6 characters
Maximum: 128 characters
This field represents email address of the end-user.
Note: During SignUp email is optional but will necessary in the later registration process.
show_consentRequired: No
Type: string
Accepted Values: 0, 1
Default Value: 1
This parameter displays a screen to collect consent from end-user before the verification process starts. If the value is set 1, the screen will be displayed to end-user. If the value is set 0, the consent screen will not be displayed. Under the GDPR, we are bound to get user’s consent therefore the default value is 1 but you can set it to 0 if you’ve already acquired the user’s consent for this biometric verification.
show_privacy_policyRequired: No
Type: string
Accepted Values: 0, 1
Default Value: 1
This parameter displays data privacy policy to end-user after the verification process is completed. If the value is set 1, the data privacy policy will be displayed to end-user. If the value is set 0, the data privacy policy will not be displayed. Under the GDPR, we acknowledge the end-users right to request for data deletion therefore the default value is 1 but you can set it to 0 if you’ve have another alternative mechanism in place.

//POST /service/biometric/auth HTTP/1.1
//Host: api.shuftipro.com
//Content-Type: application/json
//Authorization: Basic WU9VUiBDTElFTlQgSUQ6WU9VUiBDTElFTlQgU0VDUkVU

{
"webhook_url" : "http://www.example.com/",
"reference" : "123weqwe1231",
"language" : "EN",
"document" : 1,
"phone" : 1,
"question" : 1,
"request_type" : "enroll",
"email" : ""
}

Loading the SDK

The Shufti Pro SDK for JavaScript doesn’t have any standalone files that need to be downloaded or installed. You simply need to include a short piece of regular JavaScript in your HTML that will asynchronously load SDK on pages. The async loading does not block any other elements of your page.

The following snippet of code will give the basic version of the SDK where the options are set to the most common defaults.

You can use one of the two methods below to load the SDK asynchronously. Put the following code in the HTML of pages where you want to load the SDK.

Script Tag

Insert this directly after the opening body tag on every page where you want to load it.

<script async defer src="https://app.shuftipro.com/biometric/sdk/shuftipro.min.js"></script>

Function Call

<script>
( function ( d, s, id ) {
if ( d.getElementById ( id ) ) return;
let js, fjs = d.getElementsByTagName ( s )[ 0 ];
js = d.createElement ( s );
js.id = id;
js.src = "https://app.shuftipro.com/biometric/sdk/shuftipro.min.js";
fjs.parentNode.insertBefore ( js, fjs );
} ( document, 'script', 'shuftipro-jssdk' ) );
</script>

Custom Iframe

SDK will append & launch an iframe. If you want to customize the iframe for your website or application then include it according to your requirements. If no iframe is provided in the HTML then Shufti Pro will render default from the SDK.


info

The ID of the custom iFrame must be "shuftipro-iframe".


<iframe src="" id="shuftipro-iframe" allow="camera" frameborder="0"></iframe>

Initializing the SDK

After getting the access_token from the server, put it in SP's init method to initialize the SDK.

SP.init ( callback, access_token );

With above mentioned command, SDK will initialize and will be ready to get the SignUp and Login requests.


Request Parameters

ParametersDescription
callback methodRequired: Yes
Type: Function
The Client will pass the callback function. Shufti Pro will use this to return response data of verification.
access_tokenRequired: Yes
Type: string
Please put the access token you received from server to server call.

Register Request

To request for SignUp, you have to make server to server call with these parameters:


enroll-request
{
"webhook_url" : "https://example.com/",
"reference" : "rAnd0mStr1ng",
"request_type" : "enroll",
"language" : "EN",
"document" : 1,
"phone" : 1,
"question" : 1,
"email" : ""
}

You have the option to put end-user's email.


enroll-request
{
"webhook_url" : "https://example.com/",
"reference" : "rAnd0mStr1ng",
"request_type" : "enroll",
"language" : "EN",
"document" : 1,
"phone" : 1,
"question" : 1,
"email" : "[email protected]",
}

Login Request

To request for Login, you have to make server to server call with these parameters:


register-request
{
"webhook_url" : "https://example.com/",
"reference" : "rAnd0mStr1ng",
"request_type" : "authenticate",
"language" : "EN",
"document" : 1,
"phone" : 1,
"question" : 1,
"email" : ""
}

You have the option to put end-user's email.


reqister-request
{
"webhook_url" : "https://example.com/",
"reference" : "rAnd0mStr1ng",
"request_type" : "authenticate",
"language" : "EN",
"document" : 1,
"phone" : 1,
"question" : 1,
"email" : "[email protected]"
}

Full Example

This code will load and initialize the JavaScript SDK in your HTML page. It is advised to not put the Client Credentials in your javascript code. Make a server to server request to get the access_token. We use JavaScript Fetch method to request our server, and then make server to server request to get the SDK access_token. Use the example on the right for guidance.


Example

In order to initialize the SDK, we use these tags:


<input id="email" placeholder="Email..." type="email">
<label>
<input name="request_type" type="radio" value="enroll">
Enroll
</label>
<label>
<input name="request_type" type="radio" value="authenticate" checked>
Authenticate
</label>
<button onclick="spInit()">Init</button>
<br />
<iframe src="" id="shuftipro-iframe" allow="camera" frameborder="0"></iframe>

And a script tag to load the SDK asynchronously with a call to SP's server for access token and Initialize the SDK with the access token.


//POST /service/biometric/auth HTTP/1.1
//Host: api.shuftipro.com
//Content-Type: application/json
//Authorization: Basic 961551694eef2a4dc24e6367184d8e9f1191e6d

{
"webhook_url" : "https://example.com/",
"reference" : "rAnd0mStr1ng",
"request_type" : "enroll",
"language" : "EN",
"document" : 1,
"phone" : 1,
"question" : 1,
"email" : "[email protected]"
}