Phone Number Verification Component
This capability is designed to help developers initiate a phone number request to users. Only after the user's consent can the developer obtain the phone number verified by the platform, and thereby provide the corresponding service to the user.
Please note:
- This interface is currently open to non-individual developers with verified minigames (for overseas entities, it is currently only available in certain countries and regions);
- When using this capability, the user can choose to bind an existing number or add a number manually. The platform verifies the number based on underlying capabilities such as SMS provided by China's three major carriers;
- Developers should decide for themselves whether to use this feature based on their business scenario needs, and may consider adding other security verification measures when necessary.
Usage
Step 1: The developer needs to call sud.getPhoneNumber() themselves. When the user taps and consents, the callback information is obtained through the success event;
Step 2: Pass the dynamic token code from the sud.getPhoneNumber() success callback to the developer backend, and call the [phonenumber.getPhoneNumber] interface provided by the backend to consume the code in exchange for the user's phone number. Each code is valid for 5 minutes and can only be consumed once.
Note: The code returned by getPhoneNumber serves a different purpose than the code returned by sud.login, and they cannot be used interchangeably.
Code Example
sud.getPhoneNumber({
success: (res) => {
console.log(res.code); // Dynamic token
console.log(res.errMsg) // Callback information (returned on both success and failure)
console.log(res.errno) // Error code (returned on failure)
}
})Return Parameters
| Parameter | Type | Description | Minimum Version |
|---|---|---|---|
| code | String | Dynamic token. Can be used to exchange for the user's phone number. |
