Skip to main content

SMS Verification Code Login

By using SMS verification code login, you can allow users to log in via the "phone number + SMS verification code" method.

Precondition

Enabling SMS Verification Code Login

  1. Go to CloudBase Console/Authentication/Login Methods
  2. In the login methods list, choose the "SMS Verification Code Login" method and click Enable.

Registered User

For the user registration process, see User Registration.

Verification Code Login

Auth.signInWithSms method is used for SMS verification code login

const phoneNum = 'xxx';

// Send the verification code
const verificationInfo = await auth.getVerification({
phone_number: `+86 ${phoneNum}`
});

// Verification code login
const verificationCode = "000000";

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

Usage Limits and Fees

  • New pay-as-you-go environments activated, or pay-as-you-go environments activated before April 9, 2021, are entitled to a free quota of 100 SMS messages for the first month.
  • For demands exceeding the free quota, developers can visit CloudBase/Resource Packages to purchase resource packages.
  • SMS delivery is subject to frequency limits:
    • The same phone number can send at most 1 SMS message within 30 seconds.
    • A single mobile number can send up to 10 messages per calendar day