React Native SDK
This SDK has the capabilities related to OTL
Integration Steps
At its core, the solution functions through three straightforward steps:
- Start by installing OTL SDK with mobile application.
- call the
authenticate()
method. This initialises the SDK and makes the initiate api call. - You can then utilize our API to access user insights, aiding you in deciding the subsequent actions for your user.
Flow Diagram
This diagram shows the interactions between a merchant's mobile app and Bureau's SDK.
sessionId
is generated by the client backend and sent to the SDK.phoneNumber
is entered by the user- Invoke the authenticate function in SDK to make the initiate api call.
- Upon successful submission of the parameters, a callback is received in the SDK. The next steps can be taken based on the callback (success/failure).
- If the callback is successful, Invoke the Bureau's backend API
v2/auth/userinfo
to fetch user info for OTL. - Based on the user info, you can determine to login or send OTP as SMS in case of failure.
Step 1 - SDK Installation
npm install react-native-bureauid-fraud-sdk
Step 2 - Initialise SDK
Node modules changes
Make following change in node_modules/@react-native/gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt
fun configureRepositories(project: Project, reactNativeDir: File) {
......
mavenRepoFromUrl("https://www.jitpack.io")
mavenRepoFromUrl("https://packages.bureau.id/api/packages/Bureau/maven") // add this line
.....
}
On Production
// Import package
import { authenticate } from 'react-native-bureauid-fraud-sdk';
// Authenticate : phoneNumber should be starting with 91
let authResult = ''
authenticate(
credId,
sessionId,
phoneNumber,
'production',
4000 // we suggest atleast 4*1000 milli sec
).then((val) => {authResult = val}));
On Sandbox
// Import package
import { athenticate} from 'react-native-bureauid-fraud-sdk';
// Authenticate : phoneNumber should be starting with 91
let authResult = ''
authenticate(
credId,
sessionId,
phoneNumber,
'sandbox',
4000 // we suggest atleast 4*1000 milli sec
).then((val) => {authResult = val}));
The status object for authenticate method would be an integer which mean as mentioned in SDK Responses
SDK Responses
Status | Description |
---|---|
1 | AuthenticationStatus.Completed; |
-2 | AuthenticationStatus.NetworkUnavailable; |
-3 | AuthenticationStatus.OnDifferentNetwork; |
-4 | AuthenticationStatus.ExceptionOnAuthenticate; |
0(default) | AuthenticationStatus.UnknownState; |
Step 3 - Invoke API for User Info
To access insights from users for OTL, integrating with Bureau's backend API is a must for both OTL.
Please find below the link to the respective API documentations:
OTL: https://docs.bureau.id/reference/one-tap-login
- Sandbox - https://api.sandbox.bureau.id/v2/auth
- Production - https://api.bureau.id/v2/auth
Authentication
API's are authenticated via a clientID and secret, they have to be base64 encoded and sent in the header with the parameter name as Authorisation.
Authorisation : Base64(clientID:secret)
curl --location --request GET 'https://api.sandbox.bureau.id/v2/auth/userinfo?transactionId=E1DA15EB-1111-1111-A9FA-2F1F65A9D046' \
--header 'Authorization: Basic MzNjMDBg0YzZWM3NTI1OWNiOA=='
curl --location --request GET 'https://api.bureau.id/v2/auth/userinfo?transactionId=E1DA15EB-1111-1111-A9FA-2F1F65A9D046' \
--header 'Authorization: Basic MzNjMDBg0YzZWM3NTI1OWNiOA=='
API Response
Bureau's Backend API will return one of the following HTTP status codes for every request:
{
"mobileNumber": "919932403339",
"country_code": "IN",
"status": "Success",
"authenticatedAt": "1704364405"
}
{
"statusCode": 400,
"error": {
"code": 0,
"type": "BAD_REQUEST",
"message": "Session key is missing",
"description": "request does not contain additionalData.sessionKey param in request",
"referenceId": "24f94ae8-xxxx-48a4-xxxx-b25f99fb06d9",
"metadata": null
},
"timestamp": 1658402143450,
"merchantId": "auth0|61dfbbxxxx3420071be7021",
"requestId": "66403193-xxxx-44bc-xxxx-14735a45dfeb"
}
{
"data": null,
"errors": {
"status": 401,
"errorCode": "UNAUTHORIZED",
"service": "Overwatch"
},
"message": "",
"meta": {
"length": 0,
"took": 0,
"total": 0
}
}
{
"error": {
"code": 422,
"description": "Failed to find fingerprint for given session key",
"message": "NO_RECORD_FOUND",
"metadata": null,
"referenceId": "",
"type": "NO_RECORD_FOUND"
},
"merchantId": "auth0|61dfbbxxxx420071be7021",
"requestId": "24e1aa7f-xxxx-404d-xxxx-5f8a0227e8f0",
"statusCode": 422,
"timestamp": 1658402132141
}
{
"error": {
"code": 0,
"description": "",
"message": "Server encountered an error",
"metadata": null,
"referenceId": "86529a18-a5cb-4da9-91b0-8d04cdb9167e",
"type": "INTERNAL_SERVER_ERROR"
},
"merchantId": "auth0|61dfxxxx0071be7021",
"requestId": "c69d86f0-xxxx-4ef0-xxxx-e687d595a507",
"statusCode": 500,
"timestamp": 1657009043753
}
Updated about 1 month ago