Skip to main content

Email Verification Code Login

If the current user supports password login, you can bind an email address for the user. After binding, the user can log in using "Email + Password":

Precondition

Enable Email Login

  1. Go to CloudBase Console/Authentication/Login Methods
  2. In the login methods list, select "Email Verification Code Login" and click "Configure Sender Settings".
  3. After configuring the sender's SMTP settings, enable email login.

Common Email SMTP Settings

EmailSMTP HostSMTP PortSMTP Security Mode
qq Mailsmtp.qq.com465/587SSL(465)/STARTTLS(587)
Tencent Enterprise Emailsmtp.exmail.qq.com465SSL
163 Mailsmtp.163.com465SSL
gmailsmtp.gmail.com465/578SSL(465)/STARTSSL(587)

Register User

For the user registration process, see User Registration.

Email Verification Code Login

Auth.signInWithEmail method is used for email verification code login.

const email = 'xxx'

// Send the verification code
const verificationInfo = await auth.getVerification({
email: email,
});

// Assume the verification code "000000" entered by the user is received here.
const verificationCode = "000000";

// Verification code login
await auth.signInWithEmail({
verificationInfo,
verificationCode: verificationCode,
email: email,
});

Common Email Servers

QQ Mail

Step 1: Log in to QQ Mail

Go to QQ Mail homepage and log in to your QQ Mail.

Step 2: Enable the IMAP/SMTP service

After logging in to your email, go to "Settings - Account":

Then, locate the "Enable Services" setting under "Account" settings and enable the IMAP/SMTP service:

After enabling successfully, save your email login authorization code:

Note

You can also enable the POP3/SMTP service. The authorization codes for both services can be used as the SMTP account password in Step 3.

Step 3: Configure QQ Mail as the sender

Use QQ Mail as the sender address and SMTP account username, and use the authorization code from Step 2 as the SMTP account password.

gmail Mail

Step 1: Log in to gmail Mail

gamil Mail has the IMAP/SMTP service enabled by default. This step verifies whether the email is available.

Step 2: Enable google account two-step verification

https://myaccount.google.com/security?utm_source=OGB&utm_medium=app

Click Security --> 2-Step Verification to enable it.

Step 3: Enable the google account app password

https://support.google.com/accounts/answer/185833?hl=zh-Hans

Step 4: Configure the Cloud Development Platform email login SMTP

EmailSMTP Server Host
Senderyour gmail email
SMTP Server Hostsmtp.gmail.com
Port465
SMTP Account Usernameyour gmail email
SMTP Account Passwordthe app password from Step 3
SMTP Security ModeSSL