Skip to main content

TOTP Authentication

This document describes how to utilize the TOTP authentication in the Guardian-JS.
TOTP authentication can be used when the mobile device cannot access the internet.

Function Description#

TOTP authentication can be used via mobile devices with the ID and TOTP code by following the steps below.
First, click TOTP Authentication from the main screen of BSA app and then get the TOTP code. Proceed on authentication by entering the ID and TOTP code.

TOTP Authentication Request#

When the user enters the TOTP code to authenticate, the API call will be made with requestTotpCallback(). The result will be returned through onSuccess if successfully authenticated.

requestTotpCallback(userKey, totpCode, successCallback, errCallback)

Parameter#

NameTypeDescription
userKeyStringBSA user account
totpCodeStringTOTP code that user entered

Example#

const bsa = new BSA("{Client Key}");bsa.requestTotpCallback(userKey, totpCode, (data) => {  console.log('onSuccess');  console.log('accessToken : ', data.accessToken);  console.log('refreshToken : ', data.refreshToken);}, (errorCode, errorMsg) => {  console.log('onError');  console.log('errorCode : ', errorCode);  console.log('errorCode : ', errorMsg);});

onSuccess#

KeyTypeDescription
accessTokenStringAccess Token
refreshTokenStringRefresh Token

The token will be returned if authentication succeeds, and it can be utilized for the BSA authentication.

onError#

KeyTypeDescription
errorCodeIntError code
errorMsgStringError Message

If authentication fails, the error code and error message will be returned.
Possible error codes are as follows.

ErrorCodeDescriptionSolution
2000Invalid client keyCheck the client key
2008Unregistered userCheck BSA sign in status
3005TOTP code verification failureMake request for re-verification
3201Not properly linked clientAfter signing up for BSA, go through Menu => My BSA => Trusted Website => Site Link and connect with the client website
3301Unspecified client login typeError with specifying the client, contact the person in charge to solve this matter
5001Authentication timeoutMake request for authentication once again because previous authentication is no longer valid
5005Unauthorized userContact the person in charge to solve this matter
5006Temporarily suspended userContact the person in charge to solve this matter
5007Permanently suspended userContact the person in charge to solve this matter
5008Withdrawn userUser accounts can be reactivated within certain period of time by reactivation
2010User authentication in-progressDepending on the circumstances, cancel previous authentication and request for new one
5011User authentication canceledMake request for re-authentication
5015Failed to create channelIt can occur when the parameters are not enough
If it happens constantly, please inquire the person in charge
5017Failed to send push notificationProblems have occurred with the FCM(Firebase Cloud Messaging), etc.
If it happens constantly, please inquire the person in charge
5022Verification failureNode verification failed
If it happens constantly, please inquire the person in charge
5026Exceeded daily limit for TOTP authentication attemptMake request for authentication with another method