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
| Parameters | Type | Description | Note |
|---|---|---|---|
| account | string | Account Email or phone number (phones currently not supported) | Required |
| account_type | number | Account type 1: Email 2: Phone number (currently not supported) | Required |
| phone_area_code | string | Phone Area Code | Required if account_type is 2 |
| code_type | number | Verification Code Type 0: Registration 1: Change Password 2: Login, Code Registration 3: Modify Subject Registration Account | |
| only_login_type | number | 0: Auto register if account does not exist 1: Login only | Optional |
| machine_check_type | number | CAPTCHA Type 3: Tencent Captcha | Required when machine validation is enabled in Player Network settings |
| tencent_response | string | Tencent 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
| Parameters | Type | Description |
|---|---|---|
| ret | number | Return code 0: Request successful !=0: Request failed, refer to msg for detailed results |
| msg | string | Result Explanation |
| seq | string | Sequence number of the data stream message |
| expire | int64 | Token Expiration Time Unix Time |
Response sample
{
expire_time: 179998
msg: "Success"
ret: 0
seq: "1638242466-0180225865-009373-0000004742"
}