tencent cloud

Account Association
Last updated:2025-12-31 11:48:17
Account Association
Last updated: 2025-12-31 11:48:17
Each CloudBase user account can be associated with other login methods in addition to the initial login method. After association, users can log in to the same CloudBase account using any associated login method.

Login with Associated Email and Password

Assuming the current user supports password login, an email can be bound via the following method. After binding, the user can log in with email and password.
1. Users can choose to log in to CloudBase using any one of the following login methods.
2. Obtain sudo_token. Here, we use the password to obtain a sudo token. You can also use email Captcha or phone Captcha. For details, see the auth.sudo API.
const auth = app.auth();

// Assume the user input password is passwd.
const password = "passwd";

// Obtain sudo_token. The expiry date of sudo_token defaults to 10 minutes.
const sudo_token = await auth.sudo({
password: password
});
3. Send Captcha to email.
// Assume the user email is test@example.com.
const email = "test@example.com";

// Obtain email Captcha.
const verification = await auth.getVerification({
email: email
});
4. Verify the Captcha input by the user.
// Assume the user enters the Captcha 000000.
const verificationCode = "000000";

// Verify the Captcha.
const verificationTokenRes = await auth.verify({
verification_id: verification.verification_id,
verification_code: verificationCode
});
const verification_token = verificationTokenRes.verification_token
5. Bind an email with verification_token and sudo_token.
await auth.bindEmail({
sudo_token: sudo_token,
email: email,
verification_token: verification_token
});

Login with Associated Phone Password

Assuming the current user supports password login, a mobile phone number can be bound via the following method. After binding, the user can log in with the mobile phone number and password.
1. Users can choose to log in to CloudBase using any one of the following login methods.
2. Obtain sudo_token. Here, we use the password to obtain a sudo token. You can also use email Captcha or phone Captcha. For details, see the auth.sudo API.
const auth = app.auth();

// Assume the user input password is passwd.
const password = "passwd";

// Obtain sudo_token. The expiry date of sudo_token defaults to 10 minutes.
const sudo_token = await auth.sudo({
password: password
});
3. Send a verification SMS to the user's mobile phone.
const auth = app.auth();
// Assume the user's mobile phone number is 13800000000.
const phoneNumber = "+86 13800000000";

// Get a Captcha.
const verification = await auth.getVerification({
phone_number: phoneNumber
});
4. Verify the Captcha input by the user.
// Assume the user enters the Captcha 000000.
const verificationCode = "000000";

// Verify the Captcha.
const verificationTokenRes = await auth.verify({
verification_id: verification.verification_id,
verification_code: verificationCode
});
const verification_token = verificationTokenRes.verification_token
5. Bind the mobile phone number with verification_token and sudo_token.
await auth.bindPhoneNumber({
sudo_token: sudo_token,
phone_number: phoneNumber,
verification_token: verification_token
});

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback