Skip to main content

Request Verification Code (requestVerifyCode)

The requestVerifyCode API sends a verification code to the user's email or phone.For any use cases related to verification codes, call this API.

Request parameters

ParametersTypeDescriptionNote
accountstringAccount
Email or phone number (phones currently not supported)
Required
account_typenumberAccount type
1: Email
2: Phone number (currently not supported)
Required
phone_area_codestringPhone Area CodeRequired if account_type is 2
code_typenumberVerification Code Type
0: Registration
1: Change Password
2: Login, Code Registration
3: Modify Subject Registration Account
only_login_typenumber0: Auto register if account does not exist
1: Login only
Optional
machine_check_typenumberCAPTCHA Type
3: Tencent Captcha
Required when machine validation is enabled in Player Network settings
tencent_responsestringTencent Captcha response
Must be converted to a string, such as: JSON.stringify({"appid":"xxx","ret":0, "ticket":"t030...ECE*","randstr":"@BHo"})
Required when machine_check_type is 3

Request sample

accountApi.requestVerifyCode(
{
account:'xxx@gmail.com',
account_type:1,
code_type:0
}
).then((res) => {
console.log(res);
});

Response parameters

ParametersTypeDescription
retnumberReturn code
0: Request successful
!=0: Request failed, refer to msg for detailed results
msgstringResult Explanation
seqstringSequence number of the data stream message
expireint64Token Expiration Time
Unix Time

Response sample

{
expire_time: 179998
msg: "Success"
ret: 0
seq: "1638242466-0180225865-009373-0000004742"
}