Skip to main content

Account and Password Login

Users can select Mobile Number, Email, or Username as their account and use the password to log in.

Precondition

Enable Username and Password Authentication

  1. Go to CloudBase Console/Authentication/Login Methods
  2. In the login methods list, select Username/Password Login and click Enable.

Register User

For the user registration process, see User Registration.

Login Flow

Auth.signIn is used for Account and Password Login.

username can be: Mobile Number, Email, or Username

const loginState = await auth.signIn({
username: "your username",
password: "your password"
});

Currently supports registration via mobile phone verification code and email verification code, which requires setting a username during the registration process to be able to use the username for login later.

Why must users first register using another method and then bind the username?

A username can be any string that meets the rules. To prevent malicious actors from registering too many invalid usernames in your application, CloudBase currently does not allow direct user registration using the "username + password" method.