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:
verification_token: Verification code token (required), obtained from Verify SMS/Email Verification Code API
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:
verification_token: Verification code token (required), obtained from Verify SMS/Email Verification Code API
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
Responses
- 200
- 400
- 501
Response Headers
- invalid_username_or_password, incorrect username or password
- captcha_required, too many login attempts, requires verification code
- password_not_set, user password not set, needs to be set
- invalid_status, account locked due to too many retries, please try again later
Response Headers
X-Request-Id
Request ID
Example:
1e55ed89-4a2b-47f8-b7de-27b4775c2adb- username login is disabled by admin, username/password login is not enabled, go to https://tcb.cloud.tencent.com to enable identity authentication function