用户名密码登录
POST/auth/v1/signin
- 用户名密码登录,传入username、password;
- 手机号验证码登录,传入verification_token
Request
Query Parameters
client_id string
应用对应的客户端id,可从云开发平台-->身份认证-->开发设置获取。默认为环境id,可以不传
Header Parameters
x-device-id string
设备id,当前登录设备的id。客户端应随机生成,并缓存到客户端。此参数与登录账号数有关
- application/json
Body
username 用户名 (string)
用户名密码登录时必传。2-48位,支持英文大小写、数字、特殊字符(仅支持-_.:+ @),不支持中文
password 密码 (string)
用户名密码登录时必传
verification_token 验证码token (string)
验证码登录时必传。通过手机验证码登录时,传入验证码验证后,返回的验证码token
Responses
- 200
- 400
- 501
Response Headers
- application/json
- Schema
- Example (from schema)
- Example
Schema
token_type 访问令牌类型 (string)
统一返回 Bearer
access_token 用户的访问令牌 (string)
用于访问云开发HTTP API的令牌,长度4096位以内
refresh_token 用户的刷新令牌 (string)
access_token过期可通过refresh_token刷新获取新的access_token,过期时间默认为31天。长度128位以内
expires_in int32
access_token的过期时间,单位为秒
scope 授权范围 (string)
sub 用户的唯一id (string)
groups string[]
{
"token_type": "string",
"access_token": "string",
"refresh_token": "string",
"expires_in": 0,
"scope": "string",
"sub": "string",
"groups": [
"string"
]
}
{
"token_type": "Bearer",
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjlkMWRjMzFlLWI0ZDAtNDQ4Yi1hNzZmLWIwY2M2M2Q4MTQ5OCJ9.eyJpc3MiOiJodHRwOi8vbG93Y29kZS01ZzlhYzIwdTJhMjdkYTQ2LmFwLXNoYW5naGFpLnRjYi1hcGkudGVuY2VudGNsb3VkYXBpLmNvbSIsInN1YiI6IjE4NDk3NTUxMTk4NDA0OTc2NjQiLCJhdWQiOiJsb3djb2RlLTVnOWFjMjB1MmEyN2RhNDYiLCJleHAiOjE3MzQ2NzU4ODksImlhdCI6MTczNDY2ODY4OSwiYXRfaGFzaCI6InIudjVEQk10MjJSRWVHeGZ0a3VOVTFOZyIsInNjb3BlIjoidXNlciBzc28iLCJwcm9qZWN0X2lkIjoibG93Y29kZS01ZzlhYzIwdTJhMjdkYTQ2IiwicHJvdmlkZXJfdHlwZSI6ImVtYWlsIiwibWV0YSI6eyJ3eE9wZW5JZCI6IiIsInd4VW5pb25JZCI6IiJ9LCJ1c2VyX3R5cGUiOiIifQ.hOKXMtMmtbeyZSlnlprXIGVtKpBw8t7Syq45sqMX3oC2TqZ4Gl4AieQCyQF6KMLh4BH3PHt_eoJxJGQYJXx-bXalP_S94A22KpiB0n5tVb8MAV_8YbTT0oNgQeQMkGgfMMfEECle82daASgxEIHUO0UyhY0mC3O3FoGpO6rrOXVL_mOCd3Ij80dMy59XjEJn3wmnnIS3bMLAIM2GodUYT9s9C1z_p6JPWlCbxlTxst6q_lHGwvpcO8UxWvra8zQbfStn0Kej3anEYfnuWYcgLAfkAPv3eeWHii0_nLTC300Kwnhk4RCFQ7U89XHoJ4O773DeA9c4ZFdXjHicysBDUQ",
"refresh_token": "m.O0pi9CPvtWeMfpEOYrjDkYiqY5fgs1FuMhE",
"expires_in": 7200,
"sub": "1849755119840497664"
}
- invalid_username_or_password,用户名或密码有误
- captcha_required,登录失败重试次数过多等原因,需要验证码
- password_not_set,用户密码未设置,需要设置密码
- invalid_status,账号重试次数过多等原因导致账号被锁定,请稍后重试
Response Headers
X-Request-Id string
Example: 1e55ed89-4a2b-47f8-b7de-27b4775c2adb请求id
- application/json
- Schema
- Example (from schema)
- Example
Schema
error 错误信息 (string)
error_code int32
error_description 错误描述 (string)
{
"error": "string",
"error_code": 0,
"error_description": "string"
}
{
"error": "invalid_username_or_password",
"error_code": 4043,
"error_description": "Username or password incorrect."
}
- username login is disabled by admin,用户名密码未开启,前往https://tcb.cloud.tencent.com身份认证功能开启
Response Headers
- application/json
- Schema
- Example (from schema)
- Example
Schema
error stringrequired
error_code integerrequired
error_description stringrequired
{
"error": "string",
"error_code": 0,
"error_description": "string"
}
{
"error": "unimplemented",
"error_code": 12,
"error_description": "username login is disabled by admin"
}
Loading...