# 获取用户token
通过用户id或用户名或用户手机号或用户身份证获取用户的token
# 请求地址
POST https://user.djpsy1879.com/basic/auth/oauth/token
# 请求参数
| 参数名称 | 参数类型 | 必填 | 传参类型 | 说明 |
|---|---|---|---|---|
| client_id | string | 是 | query | 客户id |
| client_secret | string | 是 | query | 客户密匙 |
| grant_type | string | 是 | query | 固定值:implicit |
| username | string | 否 | query | 用户名 |
| phone | string | 否 | query | 用户的手机号 |
| id_card | string | 否 | query | 用户的身份证 |
ps:
username,phone,id_card这4个参数必须有一个不能为空
如果都不为空,会根据 username > id_card > phone 的顺序进行获取
# 响应
| 名称 | 类型 | 描述 |
|---|---|---|
| access_token | string | 认证token |
| token_type | string | token类型 |
| expires_in | number | 过期时间,单位:秒 |
| user_id | number | 用户的唯一标识 |
| msg | string | 请求错误时返回的信息 |
| code | string | 请求错误时返回的信息 |
# 示例:
{
"access_token": "76f0cb0b-f639-407e-bfa4-d51293172a75",
"token_type": "Bearer",
"expires_in": 43200,
"user_id": 1645622364222783491,
"msg": null,
"code": null
}
# 调试
将 {替换} 替换为自己的 client_id 和 client_secret
curl -d 'grant_type=implicit' \
-d 'client_id={替换}' \
-d 'client_secret={替换}' \
-d 'user_id={替换}' \
-d 'username={替换}' \
-d 'id_card={替换}' \
-d 'phone={替换}' \
-X POST https://user.djpsy1879.com/basic/auth/oauth/token