tencent cloud

Email Login
Last updated:2025-12-31 11:48:17
Email Login
Last updated: 2025-12-31 11:48:17
With email login, you can allow your users to register and log in to CloudBase using their email and password, and also update the email and password used for login.

Enabling Email Login

Step 1: Going to the Email Login Page

Go to the CloudBase Platform, in the Identity Verification > Login Methods page, select Email Login to configure sender.

Step 2: Configuring the Sender Email

After configuring the sender email SMTP settings, enable email login.
Common Email SMTP configurations:
Email
SMTP Server Host
SMTP Server Port
SMTP Security Mode
QQ Mail
smtp.qq.com
465/578
SSL(465)/STARTSSL(587)
Tencent Exmail
smtp.exmail.qq.com
465
SSL
163 Mail
smtp.163.com
465
SSL
gmail
smtp.gmail.com
465/578
SSL(465)/STARTSSL(587)

Login Process

Note:
In login authentication v2, the verification method is email Captcha. The old login authentication v1 uses activation links for login.

Step 1: Initializing the SDK

import cloudbase from "@cloudbase/js-sdk";

const app = cloudbase.init({
env: "your-env-id"
});

Step 2: Using Email to Register an Account

First, the user needs to enter an email and obtain a Captcha.
// Assume the user enters the email test@example.com
const email = "test@example.com";
const verification = await auth.getVerification({
email: email
});
After calling the registration API, CloudBase will use the pre-configured email to send a verification email to the user's email. The email contains a Captcha. After the user further enters the Captcha, call the following API to verify the correctness of the Captcha.
// Assume the user enters the Captcha 000000.
const verificationCode = "000000";
// Verify the correctness of the Captcha.
const verificationTokenRes = await auth.verify({
verification_id: verification.verification_id,
verification_code: verificationCode
});

Step 3: Using Email to Register and Log in to CloudBase

// If the user already exists, log in.
if (verification.is_user) {
await auth.signIn({
username: email,
verification_token: verificationTokenRes.verification_token
});
} else {
// Otherwise, register a new user and set a password and username.
// Remark: Upon successful signUp, the user will be automatically logged in.
await auth.signUp({
email: email,
verification_code: verificationCode,
verification_token: verificationTokenRes.verification_token,
// Optional, set username.
username: "userFromEmail",
// Optional, set password.
password: "password123"
});
}
Note:
Password length should be not less than 8 and not greater than 32, and should contain both letters and numbers.

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

Feedback