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
scopeis"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 corresponding to the application, can be obtained from Cloud Development Platform -> Identity Authentication -> Development Settings. Defaults to environment ID, can be omitted
Header Parameters
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
- application/json
Body
Responses
- 200
- 400
- 403
- 500
A successful response.
Response Headers
- application/json
- Schema
- Example (from schema)
- Example
Schema
Uniformly return Bearer
Token used to access Cloud Development HTTP API, length within 4096 bits
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
Expiration time of access_token, in seconds
{
"token_type": "string",
"access_token": "string",
"refresh_token": "string",
"expires_in": 0,
"scope": "string",
"sub": "string",
"groups": [
"string"
]
}
{
"token_type": "Bearer",
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FwaS5leGFtcGxlLmNvbSIsInN1YiI6Ijk4NzY1NDMyMTAxMjM0NTY3ODkiLCJhdWQiOiJkZW1vLWFwcC0yZjhhOWMzZTFiNGQiLCJleHAiOjE3MzQ2NzU4ODksImlhdCI6MTczNDY2ODY4OSwic2NvcGUiOiJ1c2VyIn0.dGhpc19pc19hX2Zha2Vfc2lnbmF0dXJlX2Zvcl9leGFtcGxlX3B1cnBvc2VzX29ubHlfZG9fbm90X3VzZV9pbl9wcm9kdWN0aW9uX2Vudmlyb25tZW50X3RoaXNfaXNfbm90X3JlYWxfdG9rZW5fZGF0YQ",
"expires_in": 7200,
"scope": "anonymous",
"sub": 1234567890
}
- invalid_argument, please add device ID in the request header, x-device-id is not passed in the Header
- unimplemented, please contact the administrator to enable anonymous login, anonymous login is not enabled, go to the Cloud Development Platform to enable it
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
{}
Response Headers
- application/json
- Schema
- Example (from schema)
- Example
Schema
{}
{
"error": "permission_denied",
"error_code": 7,
"error_description": "cors permission denied, please check if demo-app-3g4h5i6j7k8l-9876543210.example.com in your client XyZ9aB1cD2eF3gH4iJ5 domains"
}
An unexpected error response.
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
{
"error": "string",
"error_code": 0,
"error_description": "string"
}