Skip to content

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

kotlin
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

NameValueDescription
userKeyStringUser key to check for duplication

Response

NameTypeDescription
rtCodeIntResult code
rtMsgStringResult message

ResultCode

rtCodeDescription
0Success
2009In 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

kotlin
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

NameValueDescription
verifyTypeStringData type to check for duplication (Use SdkConstant.OtpType)
verifyDataStringData to check for duplication

Response

NameTypeDescription
rtCodeIntResult code
rtMsgStringResult message

ResultCode

rtCodeDescription
0Success
2019In 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

kotlin
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

NameValueDescription
clientKeyStringUnique key of the client
emailStringUser's email
phoneNumStringUser's phone number

Response

NameTypeDescription
rtCodeIntResult code
rtMsgStringResult 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

kotlin
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

NameValueDescription
clientKeyStringUnique key of the client
emailStringUser's email
authNumStringOTP number entered by the user

Response

NameTypeDescription
rtCodeIntResult code
rtMsgStringResult message
{data}class
data.resultBooleanVerification result
data.disposeTokenStringVerification 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

kotlin
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

NameValueDescription
clientKeyStringUnique key of the client
phoneNumStringUser's phone number

Response

NameTypeDescription
rtCodeIntResult code
rtMsgStringResult 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

kotlin
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

NameValueDescription
clientKeyStringUnique key of the client
phoneNumStringUser's phone number
authNumStringOTP number entered by the user

Response

NameTypeDescription
rtCodeIntResult code
rtMsgStringResult message
{data}class
data.resultBooleanVerification result
data.disposeTokenStringVerification token

vii. Biometric Authentication Registration

This is a mandatory process during user registration. It is a method to register biometric authentication information.

Example

kotlin
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

NameTypeDescription
rtCodeIntResult code
rtMsgStringResult 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

kotlin
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

NameValueDescription
userKeyStringUser ID
nameStringUser name
phoneNumStringUser's phone number
emailStringUser's email
authTypeStringAuthentication type
agreeGccsBooleanAgreement to terms of use
agreePersonBooleanAgreement to personal information processing policy
agreeDeviceBooleanAgreement to device information use
disposeTokenStringToken received after email or SMS verification
tokenStringFCM token

Response

NameTypeDescription
rtCodeIntResult code
rtMsgStringResult message