Skip to main content

User Login API

POST 

/auth/v1/signin

Login Scenarios Explanation

1. Username/Password Login

Input Requirements:

  • username: Username (required, 2-48 characters, supports English letters (case-sensitive), numbers, special characters (only -_.:+ @), must start with a letter or number, Chinese characters not supported)
  • password: Password (required)

Prerequisites:

  • Registered users can use username/password login

Username/Password Login Request Example

{
"username": "zhangsan",
"password": "example password"
}

Username/Password Login Response Example

{
"token_type": "Bearer",
"access_token": "your_access_token",
"refresh_token": "m.aB3cD4eF5gH6iJ7kL8mN9oP0qR1sT2uV3wX4yZ5aB6cD7eF8gH9iJ0kL1mN2oP3qR4sT5uV6wX7yZ8",
"expires_in": 7200,
"sub": "9876543210123456789"
}

2. Phone Number Verification Code Login

Input Requirements:

Prerequisites:

  • Need to call verification code sending API first to get verification code
  • Get verification_token after verification code validation passes

Phone Number Verification Code Login Request Example

{
"verification_token": "your_verification_token"
}

Phone Number Verification Code Login Response Example

{
"token_type": "Bearer",
"access_token": "your_access_token",
"refresh_token": "m.aB3cD4eF5gH6iJ7kL8mN9oP0qR1sT2uV3wX4yZ5aB6cD7eF8gH9iJ0kL1mN2oP3qR4sT5uV6wX7yZ8",
"expires_in": 7200,
"sub": "9876543210123456789"
}

3. Email Verification Code Login

Input Requirements:

Prerequisites:

  • Need to call email verification code sending API first to get verification code
  • Get verification_token after verification code validation passes

Email Verification Code Login Request Example

{
"verification_token": "your_verification_token"
}

Email Verification Code Login Response Example

{
"token_type": "Bearer",
"access_token": "your_access_token",
"refresh_token": "m.aB3cD4eF5gH6iJ7kL8mN9oP0qR1sT2uV3wX4yZ5aB6cD7eF8gH9iJ0kL1mN2oP3qR4sT5uV6wX7yZ8",
"expires_in": 7200,
"sub": "9876543210123456789"
}

General Notes:

  • The three login methods are mutually exclusive, only one method can be used per request
  • For verification code login, need to obtain verification_token from Verify SMS/Email Verification Code API
  • Returns standard token response after successful login

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 string

    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 related to the number of logged-in accounts.

Body

    username Username (string)

    Required when logging in with username and password. 2-48 characters, supports English letters (case-sensitive), numbers, special characters (only -_.:+ @), must start with a letter or number, Chinese characters not supported

    password Password (string)

    Required when logging in with username and password

    verification_token Verification code token (string)

    Required when logging in with verification code. When logging in with phone verification code, the verification code token returned after verification. Obtained through the verify SMS/email verification code API

Responses

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...