Skip to main content

Anonymous Login

Under anonymous login status, users can normally access CloudBase resources. Developers can configure corresponding access restrictions for anonymous users in conjunction with security rules.

Precondition

Enabling Anonymous Login

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

Login Flow

For the auth instance, see SDK Initialization

Auth.signInAnonymously is used for anonymous login

await auth.signInAnonymously();
const loginScope = await auth.loginScope();
// If it is an anonymous login, returns true.
console.log(loginScope === "anonymous");