tencent cloud

CloudBase

Product Introduction
Product Overview
Features and Strengths
Use Cases
System Limits
Purchase Guide
Product Pricing
Description Of Billing Capability Items
Yearly/Monthly Subscription Package Description
Alarm and Notification
Overdue Payment Instructions
Development Guide
Cloud Storage
Database
Identity Verification
Cloud function
Static website management
SDK Documentation
Client SDK
Server SDKs
Management-side SDK
Product Agreement
Cloud Development Service Level Agreement

Account Association

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 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
});


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백