Skip to content

Authentication

With BSA authentication, user can be verified without any password.

In the process of authentication request to node verification, the token will be provided if the user has passed without any trouble.

The token is used for API features such as checking authentication history.

i. Normal Authentication

This is a method for processing authentication requests received from external sources.

Example

kotlin
BsaSdk.getInstance().sdkService.normalAuthenticator(userKey, isAuth, fragmentActivity, object: SdkAuthResponseCallback<AuthCompleteResponse> callback {
	override fun onSuccess(result: AuthCompleteResponse?) {  
	    ...
	}  
	override fun onFailed(errorResult: ErrorResult?) {  
	    ...
	}
})

Parameter

NameTypeDescription
userKeyStringUser ID
isAuthBooleanSuccess of the previous authentication step ('Authentication Start' or 'Biometric Authentication')
fragmentActivityFragmentActivityAn activity object to display local authentication

Response

NameTypeDescription
rtCodeIntResult Code
rtMsgStringResult Message

ii. In-App Authentication

This is a method for handling authentication requests generated within the app.

Example

kotlin
BsaSdk.getInstance().sdkService.appAuthenticator(userKey, isAuth, fragmentActivity, object: SdkAuthResponseCallback<AuthResultResponse> callback) {
	override fun onSuccess(result: AuthResultResponse?) {  
	    ...
	}  
	override fun onFailed(errorResult: ErrorResult?) {  
	    ...
	}
})

Parameter

NameTypeDescription
userKeyStringUser ID
isAuthBooleanSuccess of the previous authentication step ('Authentication Start' or 'Biometric Authentication')
fragmentActivityFragmentActivityAn activity object to display local authentication

Response

NameTypeDescription
rtCodeIntResult Code
rtMsgStringResult Message

iii. QR Authentication

This is a method used for processing authentication via QR codes.

Example

kotlin
BsaSdk.getInstance().sdkService.qrAuthenticator(userKey, qrId, isAuth, fragmentActivity, object: SdkAuthResponseCallback<AuthCompleteResponse> callback {
	override fun onSuccess(result: AuthCompleteResponse?) {  
	    ...
	}  
	override fun onFailed(errorResult: ErrorResult?) {  
	    ...
	}
})

Parameter

NameTypeDescription
userKeyStringUser ID
qrIdStringQR ID extracted through QR library
isAuthBooleanSuccess of the previous authentication step ('Authentication Start' or 'Biometric Authentication')
fragmentActivityFragmentActivityAn activity object to display local authentication

Response

NameTypeDescription
rtCodeIntResult Code
rtMsgStringResult Message

iv. OTP View Authentication

This is a method used for processing authentication with OTP (One-Time Password) numbers.

Example

kotlin
BsaSdk.getInstance().sdkService.otpViewAuthenticator(userKey, isAuth, fragmentActivity, object: SdkAuthResponseCallback<AuthResultResponse> callback) {
	override fun onSuccess(result: AuthResultResponse?) {  
	    ...
	}  
	override fun onFailed(errorResult: ErrorResult?) {  
	    ...
	}
})

Parameter

NameTypeDescription
userKeyStringUser ID
isAuthBooleanSuccess of the previous authentication step ('Authentication Start' or 'Biometric Authentication')
fragmentActivityFragmentActivityAn activity object to display local authentication

Response

NameTypeDescription
rtCodeIntResult Code
rtMsgStringResult Message

ErrorResult

It returns an error code when it fails to call API for the authentication cancel.

KeyValueDescription
errorCodeIntError Code
errorMessageStringError Message

v. Authentication Cancellation

Request authentication cancellation using BsaSdk's cancelAuth().

Example

kotlin
BsaSdk.getInstance().sdkService.cancelAuth(object: SdkResponseCallback<AuthCancelResponse> {
	override fun onSuccess(authCancel: AuthCancelResponse?) {
		// Code to be executed after 'Authentication Cancellation' success
		...
	}
	override fun onFailed(authFailed: ErrorResult?) {
		...
	}
})

Parameter

none

AuthCancelResponse

KeyValueDescription
rtCodeIntReturn code
rtMsgStringReturn message

vi. Checking Existing Authentication Requests

If you want to check if there's currently an ongoing authentication process, you can request information using BsaSdk's existAuth().

Example

kotlin
BsaSdk.getInstance().sdkService.existAuth(userKey, object: SdkResponseCallback<AuthExistResponse> {
	override fun onSuccess(authExist: AuthExistResponse?) {  
	    // Code to be executed if there's currently an ongoing authentication
	    ...
	}  
	override fun onFailed(authFailed: ErrorResult?) {  
	    ...
	}
})

Parameter

KeyValueDescription
userKeyStringUser ID

AuthExistResponse

KeyValueDescription
rtCodeIntReturn code
rtMsgStringReturn message
data.isExistBooleanWhether authentication is in progress or not
data.clientKeyStringUnique client key
data.siteUrlStringSite URL where authentication is in progress
data.timeoutStringExpiry time
data.clientNameStringClient name

vii. Retrieving OTP Number

Retrieve the OTP number for BSA authentication by requesting the API using BsaSdk's getAuthOtpCode().

Example

kotlin
BsaSdk.getInstance().sdkService.getAuthOtpCode(object: SdkResponseCallback<OtpGenerateResponse> {
	override fun onSuccess(result: OtpGenerateResponse?) {  
	    // Use the received OTP code
	    val otpCode = result.data
	    ...
	}  
	override fun onFailed(authFailed: ErrorResult?) {  
	    ...
	}
})

Parameter

  • none

OtpGenerateResponse

When it succeeds to call API for the authentication result, it returns 0 for rtCode and the ongoing authentication process is cancelled.

KeyValueDescription
rtCodeIntReturn code
rtMsgStringReturn message
dataStringOTP number

viii. OTP Number Cancellation Request

Cancel (expire) the BSA authentication OTP number by requesting the API using BsaSdk's cancelOtp().

Example

kotlin
BsaSdk.getInstance().sdkService.cancelOtp(otpCode, object: SdkResponseCallback<OtpCancelResponse> {
	override fun onSuccess(result: OtpCancelResponse?) {  
	    ...
	}  
	override fun onFailed(authFailed: ErrorResult?) {  
	    ...
	}
})

Parameter

KeyValueDescription
otpCodeStringOTP number

OtpCancelResponse

KeyValueDescription
rtCodeIntReturn code
rtMsgStringReturn message