Skip to main content

Anonymous Login

POST 

/auth/v1/signin/anonymously

API Description

Anonymous login API. A single device ID can register at most one anonymous user and generate an access_token for that anonymous user.

Input Requirements

  • x-device-id: Device ID (required, passed in the request header)
  • client_id: Client ID corresponding to the application (optional, defaults to environment ID)

Prerequisites

  • A single device ID can only register one anonymous user.
  • The device ID must be randomly generated by the client and cached locally.

Output

  • Returns a standard token response (access_token, refresh_token, etc.).
  • The scope is "anonymous", indicating an anonymous user.

Request Example

POST /auth/v1/signin/anonymously
x-device-id: device_123456
Content-Type: application/json

{}

Response Example

{
"token_type": "Bearer",
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FwaS5leGFtcGxlLmNvbSIsInN1YiI6Ijk4NzY1NDMyMTAxMjM0NTY3ODkiLCJhdWQiOiJkZW1vLWFwcC0yZjhhOWMzZTFiNGQiLCJleHAiOjE3MzQ2NzU4ODksImlhdCI6MTczNDY2ODY4OSwic2NvcGUiOiJ1c2VyIn0.dGhpc19pc19hX2Zha2Vfc2lnbmF0dXJlX2Zvcl9leGFtcGxlX3B1cnBvc2VzX29ubHlfZG9fbm90X3VzZV9pbl9wcm9kdWN0aW9uX2Vudmlyb25tZW50X3RoaXNfaXNfbm90X3JlYWxfdG9rZW5fZGF0YQ",
"expires_in": 7200,
"scope": "anonymous",
"sub": "7ft9WRremXrz-TfgoAR9Uw"
}

Key Characteristics

  • A single device ID can create only one anonymous user.
  • Anonymous users do not have personal information such as username or password.
  • Suitable for scenarios such as trial use or guest experience.
  • Can be upgraded to a regular user by binding other login methods.

Request

Query Parameters

    client_id string

    Client ID corresponding to the application, can be obtained from Cloud Development Platform -> Identity Authentication -> Development Settings. Defaults to environment ID, can be omitted

Header Parameters

    x-device-id stringrequired

    Required for anonymous login. Device ID, the ID of the current logged-in device. The client should generate it randomly and cache it on the client. This parameter is used to calculate the user ID during anonymous login, and if not cached, it will cause the anonymous user to log in again and the user ID to change

Body

    object

Responses

A successful response.

Response Headers
    Schema
      token_type Access token type (string)

      Uniformly return Bearer

      access_token User's access token (string)

      Token used to access Cloud Development HTTP API, length within 4096 bits

      refresh_token User's refresh token (string)

      access_token can be refreshed to get a new access_token when it expires through refresh_token, expiration time defaults to 31 days. Length within 128 bits

      expires_in int32

      Expiration time of access_token, in seconds

      scope Authorization scope (string)
      sub User's unique ID (string)
      groups string[]
    Loading...