Skip to main content

Device Re-registration

Overview#

This document describes how to implement GCCS device re-registration and integrate with the iOS SDK.


Feature Description#

What can be done if the user wishes to continue using GCCS after changing his/her mobile device?
It is possible to use GCCS features like before by user information verification and re-registration.
In this way, the user can use GCCS with a new mobile device.
To do so, the iOS SDK will first check the user history and then verify the user by sending OTP code to their email or phone number.

User Verification and OTP Delivery#

Use sendOTPInRegisterDevice() from GuardianSdk to call the API.
If the user has been verified in the past, he/she will receive the OTP code via email or SMS.

Parameter#

KeyValueDescription
userKeyStringUser ID/Key
nameStringName
verifyTypeString- CMMDUP001 : Email
- CMMDUP002 : SMS
verifyDataStringDepends on the verifyType
- If verifyType is CMMDUP001, verifyData is email
- If verifyType is CMMDUP002, verifyData is phone number

The value must be Dictionary<KeyType, ValueType> type.

Example#

// User check and OTP deliveryGuardianAPI.sharedInstance.sendOTPInRegisterDevice(userKey: userKey,                                                    name: name,                                                    verifyType: verifyType,                                                    verifyData: verifyData) { rtCode, response in    ...    } onFailed: { error in    ...    }

SendOTPInRegisterDevice#

KeyValueDescription
rtCode0Result code
rtMsgStringResult message
seqIntseq

When the API call to verify the user and deliver OTP code is successful, the rtCode will be 0.
The seq value will be used for verifyOTPByEmail() and verifyOTPBySms().

ErrorResult#

KeyValueDescription
errorCodeIntError code
errorMessageStringError message

If API call fails, the user will receive an errorCode.


OTP Verification#

Use sendOTPInRegisterDevice() from GuardianSdk to call the API that can send OTP code to the user.
Then with verifyOTPByEmail() and verifyOTPBySms(), verify user by comparing the OTP code.

Parameter#

KeyValueDescription
clientKeyStringClient key
email, phoneNumStringFor verifyOTPByEmail(), email will be used. For verifyOTPBySms(), phone number will be used
authNumStringOTP code (6 digits) delivered to the user's email or phone number
seqStringsendOTPInRegisterDevice() result seq

The value must be in Dictionary<KeyType, ValueType> type.

Example#

// OTP VerificationGuardianAPI().verifyOTPByEmail(email: params["email"] as! String,                            authNum: otpNumber) { rtCode, result, data  in    ...                  } onFailed: { error, errorMsg in    ...    }

VerityOtpResponse#

KeyValueDescription
rtCode0Result code
rtMsgStringResult message
dataStringToken to verify OTP code for re-registration

When the API call to verify the user and deliver OTP code is successful, the rtCode will be 0
The data value will be used for re-registration with the requestReMemberRegister()

ErrorResult#

KeyValueDescription
errorCodeIntError code
ErrorMessageStringError message

If API call fails, the user will receive an errorCode


Device re-registration#

Use requestReMemberRegister() from GuardianSdk to call the API. The token verified with VerifyOtpByEmail() and VerifyOtpBySms() is required.
When the re-registration is complete, the user can utilize GCCS authentication as usual.

Parameter#

KeyValueDescription
disposeTokenStringToken resulted from VerifyOtpByEmail()and VerifyOtpBySms()
otpTypeStringVerification type when calling verityUserToOtp()
- CMMDUP001 : Email
- CMMDUP002 : SMS
resultBoolOTP authentication result

The value must be in Dictionary<KeyType, ValueType> type.

Example#

// Device registrationGuardianService.sharedInstance.requestReMemberRegister(memberObject: self.params) { rtCode, rtMsg, data in    ...    } onFailed: { error, errMsg in    ...    }

ReRegisterClientUserResponse#

KeyValueDescription
rtCode0Result code
rtMsgStringResult message

When the API call to re-register is successful, the rtCode will be 0

ErrorResult#

KeyValueDescription
errorCodeIntError code
errorMessageStringError message

If API call fails, the user will receive an errorCode