User Registration
Overview
This guide explains the registration and integration method of the BSA via the Android SDK.
Feature Description
Provides the feature to register and integrate with BSA using member information.
i. User ID Duplication Check
Before proceeding with BSA registration, check if there is a duplicate user ID. Use BsaSdk
's isDuplicateUserKey()
to request the API.
Example
BsaSdk.getInstance().sdkService.isDuplicateUserKey(userKey, object: SdkResponseCallback<CheckDuplicateUserKeyResponse> {
override fun onSuccess(result: CheckDuplicateUserKeyResponse) {
// Code to run if user ID is not duplicated
...
}
override fun onFailed(errorResult: ErrorResult?) {
// Code to run if user ID is duplicated or connection failed
...
}
})
Parameter
Name | Value | Description |
---|---|---|
userKey | String | User key to check for duplication |
Response
Name | Type | Description |
---|---|---|
rtCode | Int | Result code |
rtMsg | String | Result message |
ResultCode
rtCode | Description |
---|---|
0 | Success |
2009 | In case of an already registered user ID |
ii. Email or Phone Number Duplication Check
Before proceeding with BSA registration, check if there is a duplicate email or phone number. Use BsaSdk
's isDuplicatedEmailOrPhoneNumber()
to request the API.
Example
val params : HashMap<String, String> = HashMap()
params["verifyType"] = SdkConstant.OtpType.EMAIL.value
params["verifyData"] = "{email}"
// or for SMS
// params["verifyType"] = SdkConstant.OtpType.SMS.value
// params["verifyData"] = "phoneNumber"
BsaSdk.getInstance().sdkService.isDuplicatedEmailOrPhoneNumber(params, object: SdkResponseCallback<CheckDuplicateEmailOrPhoneNumberReponse> {
override fun onSuccess(result: CheckDuplicateEmailOrPhoneNumberReponse?) {
// Code to run if not duplicated
...
}
override fun onFailed(errorResult: ErrorResult?) {
// Code to run if duplicated or connection failed
...
}
})
Parameter
Name | Value | Description |
---|---|---|
verifyType | String | Data type to check for duplication (Use SdkConstant.OtpType) |
verifyData | String | Data to check for duplication |
Response
Name | Type | Description |
---|---|---|
rtCode | Int | Result code |
rtMsg | String | Result message |
ResultCode
rtCode | Description |
---|---|
0 | Success |
2019 | In case of already registered data |
iii. Email Verification Request
To register with BSA, you need to verify your email. Request email verification by using BsaSdk
's sendOtpByEmail()
API. If the request is successful, a registration verification code will be sent to the input email.
Example
val params : HashMap<String, Any> = HashMap()
params["clientKey"] = "{CLIENT_KEY}"
params["email"] = "{email}"
BsaSdk.getInstance().sdkService.sendOtpByEmail(params, object: SdkResponseCallback<SendOtpResponse> {
override fun onSuccess(result: SendOtpResponse?) {
// Code to run after successful request
...
}
override fun onFailed(errorResult: ErrorResult?) {
...
}
})
Parameter
Name | Value | Description |
---|---|---|
clientKey | String | Unique key of the client |
String | User's email | |
phoneNum | String | User's phone number |
Response
Name | Type | Description |
---|---|---|
rtCode | Int | Result code |
rtMsg | String | Result message |
iv. Email Verification Confirmation
Use the seq
result value from sendOtpByEmail()
, the registration verification code shown in the email, and input the email to confirm email verification. Confirm email verification by using BsaSdk
's verifyOtpByEmail()
API. If the registration verification code is valid, the token
for registration will be provided.
Example
val params : HashMap<String, Any> = HashMap()
params["clientKey"] = "{CLIENT_KEY}"
params["email"] = "{email}"
params["authNum"] = "{authNumber}"
BsaSdk.getInstance().sdkService.verifyOtpByEmail(params, object: Sdk
ResponseCallback<VerifyOtpResponse> {
override fun onSuccess(result: VerifyOtpResponse?) {
// Code to run after email verification
...
}
override fun onFailed(errorResult: ErrorResult?) {
...
}
})
Parameter
Name | Value | Description |
---|---|---|
clientKey | String | Unique key of the client |
String | User's email | |
authNum | String | OTP number entered by the user |
Response
Name | Type | Description |
---|---|---|
rtCode | Int | Result code |
rtMsg | String | Result message |
{data} | class | |
data.result | Boolean | Verification result |
data.disposeToken | String | Verification token |
v. SMS Verification Request
To register with BSA, SMS verification is required. Request SMS verification by using BsaSdk
's sendOtpBySms()
API. If the request is successful, a registration verification code will be sent via SMS.
Example
val params : HashMap<String, Any> = HashMap()
params["clientKey"] = "{CLIENT_KEY}"
params["phoneNum"] = "{phoneNumber}"
BsaSdk.getInstance().sdkService.sendOtpBySms(params, object: SdkResponseCallback<SendOtpResponse> {
override fun onSuccess(result: SendOtpResponse?) {
//
...
}
override fun onFailed(errorResult: ErrorResult?) {
...
}
})
Parameter
Name | Value | Description |
---|---|---|
clientKey | String | Unique key of the client |
phoneNum | String | User's phone number |
Response
Name | Type | Description |
---|---|---|
rtCode | Int | Result code |
rtMsg | String | Result message |
vi. SMS Verification Confirmation
Use the seq
result value from sendOtpByEmail()
, the registration verification code shown in the SMS, and input the SMS to confirm SMS verification. Confirm SMS verification by using BsaSdk
's verifyOtpBySms()
API. If the registration verification code is valid, the token
for registration will be provided.
Example
val params : HashMap<String, Any> = HashMap()
params["clientKey"] = "{CLIENT_KEY}"
params["phoneNum"] = "{phoneNumber}"
params["authNum"] = "{authNumber}"
BsaSdk.getInstance().sdkService.verifyOtpBySms(params, object: SdkResponseCallback<VerifyOtpResponse> {
override fun onSuccess(result: VerifyOtpResponse?) {
...
}
override fun onFailed(errorResult: ErrorResult?) {
...
}
})
Parameter
Name | Value | Description |
---|---|---|
clientKey | String | Unique key of the client |
phoneNum | String | User's phone number |
authNum | String | OTP number entered by the user |
Response
Name | Type | Description |
---|---|---|
rtCode | Int | Result code |
rtMsg | String | Result message |
{data} | class | |
data.result | Boolean | Verification result |
data.disposeToken | String | Verification token |
vii. Biometric Authentication Registration
This is a mandatory process during user registration. It is a method to register biometric authentication information.
Example
BsaSdk.getInstance().sdkService.registerBiometric(fragmentActivity, object: SdkResponseCallback<AuthBiometricResponse> {
override fun onSuccess(authBiometric: AuthBiometricResponse?) {
// Code to execute after registration
...
}
override fun onFailed(errorResult: ErrorResult?) {
...
}
})
Parameter
- none
Response
Name | Type | Description |
---|---|---|
rtCode | Int | Result code |
rtMsg | String | Result message |
viii. Registration
To register with BSA, request the API using BsaSdk
's registerUser()
. You need the token
received after confirming email or SMS verification in addition to the basic information.
Example
val params: MutableMap<String, Any> = HashMap()
params["userKey"] = "{userKey}"
params["name"] = "{name}"
params["phoneNum"] = "{phoneNum}"
params["email"] = "{email}"
params["authType"] = "{authType}"
params["agreeGccs"] = true
params["agreePerson"] = true
params["agreeDevice"] = true
params["disposeToken"] = "{disposeToken}"
FirebaseMessaging.getInstance().token.addOnSuccessListener { token ->
params["token"] = token
}
BsaSdk.getInstance().sdkService.registerUser(map, object: SdkResponseCallback<RegisterUserResponse> {
override fun onSuccess(result: RegisterUserResponse?) {
...
}
override fun onFailed(errorResult: ErrorResult?) {
...
}
})
Parameter
Name | Value | Description |
---|---|---|
userKey | String | User ID |
name | String | User name |
phoneNum | String | User's phone number |
String | User's email | |
authType | String | Authentication type |
agreeGccs | Boolean | Agreement to terms of use |
agreePerson | Boolean | Agreement to personal information processing policy |
agreeDevice | Boolean | Agreement to device information use |
disposeToken | String | Token received after email or SMS verification |
token | String | FCM token |
Response
Name | Type | Description |
---|---|---|
rtCode | Int | Result code |
rtMsg | String | Result message |