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
BsaSdk.getInstance().sdkService.normalAuthenticator(userKey, isAuth, fragmentActivity, object: SdkAuthResponseCallback<AuthCompleteResponse> callback {
override fun onSuccess(result: AuthCompleteResponse?) {
...
}
override fun onFailed(errorResult: ErrorResult?) {
...
}
})
Parameter
Name | Type | Description |
---|---|---|
userKey | String | User ID |
isAuth | Boolean | Success of the previous authentication step ('Authentication Start' or 'Biometric Authentication') |
fragmentActivity | FragmentActivity | An activity object to display local authentication |
Response
Name | Type | Description |
---|---|---|
rtCode | Int | Result Code |
rtMsg | String | Result Message |
ii. In-App Authentication
This is a method for handling authentication requests generated within the app.
Example
BsaSdk.getInstance().sdkService.appAuthenticator(userKey, isAuth, fragmentActivity, object: SdkAuthResponseCallback<AuthResultResponse> callback) {
override fun onSuccess(result: AuthResultResponse?) {
...
}
override fun onFailed(errorResult: ErrorResult?) {
...
}
})
Parameter
Name | Type | Description |
---|---|---|
userKey | String | User ID |
isAuth | Boolean | Success of the previous authentication step ('Authentication Start' or 'Biometric Authentication') |
fragmentActivity | FragmentActivity | An activity object to display local authentication |
Response
Name | Type | Description |
---|---|---|
rtCode | Int | Result Code |
rtMsg | String | Result Message |
iii. QR Authentication
This is a method used for processing authentication via QR codes.
Example
BsaSdk.getInstance().sdkService.qrAuthenticator(userKey, qrId, isAuth, fragmentActivity, object: SdkAuthResponseCallback<AuthCompleteResponse> callback {
override fun onSuccess(result: AuthCompleteResponse?) {
...
}
override fun onFailed(errorResult: ErrorResult?) {
...
}
})
Parameter
Name | Type | Description |
---|---|---|
userKey | String | User ID |
qrId | String | QR ID extracted through QR library |
isAuth | Boolean | Success of the previous authentication step ('Authentication Start' or 'Biometric Authentication') |
fragmentActivity | FragmentActivity | An activity object to display local authentication |
Response
Name | Type | Description |
---|---|---|
rtCode | Int | Result Code |
rtMsg | String | Result Message |
iv. OTP View Authentication
This is a method used for processing authentication with OTP (One-Time Password) numbers.
Example
BsaSdk.getInstance().sdkService.otpViewAuthenticator(userKey, isAuth, fragmentActivity, object: SdkAuthResponseCallback<AuthResultResponse> callback) {
override fun onSuccess(result: AuthResultResponse?) {
...
}
override fun onFailed(errorResult: ErrorResult?) {
...
}
})
Parameter
Name | Type | Description |
---|---|---|
userKey | String | User ID |
isAuth | Boolean | Success of the previous authentication step ('Authentication Start' or 'Biometric Authentication') |
fragmentActivity | FragmentActivity | An activity object to display local authentication |
Response
Name | Type | Description |
---|---|---|
rtCode | Int | Result Code |
rtMsg | String | Result Message |
ErrorResult
It returns an error code when it fails to call API for the authentication cancel.
Key | Value | Description |
---|---|---|
errorCode | Int | Error Code |
errorMessage | String | Error Message |
v. Authentication Cancellation
Request authentication cancellation using BsaSdk's cancelAuth().
Example
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
Key | Value | Description |
---|---|---|
rtCode | Int | Return code |
rtMsg | String | Return 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
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
Key | Value | Description |
---|---|---|
userKey | String | User ID |
AuthExistResponse
Key | Value | Description |
---|---|---|
rtCode | Int | Return code |
rtMsg | String | Return message |
data.isExist | Boolean | Whether authentication is in progress or not |
data.clientKey | String | Unique client key |
data.siteUrl | String | Site URL where authentication is in progress |
data.timeout | String | Expiry time |
data.clientName | String | Client name |
vii. Retrieving OTP Number
Retrieve the OTP number for BSA authentication by requesting the API using BsaSdk's getAuthOtpCode().
Example
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.
Key | Value | Description |
---|---|---|
rtCode | Int | Return code |
rtMsg | String | Return message |
data | String | OTP number |
viii. OTP Number Cancellation Request
Cancel (expire) the BSA authentication OTP number by requesting the API using BsaSdk's cancelOtp().
Example
BsaSdk.getInstance().sdkService.cancelOtp(otpCode, object: SdkResponseCallback<OtpCancelResponse> {
override fun onSuccess(result: OtpCancelResponse?) {
...
}
override fun onFailed(authFailed: ErrorResult?) {
...
}
})
Parameter
Key | Value | Description |
---|---|---|
otpCode | String | OTP number |
OtpCancelResponse
Key | Value | Description |
---|---|---|
rtCode | Int | Return code |
rtMsg | String | Return message |