有奖捉虫:办公协同&微信生态&物联网文档专题 HOT

接口描述

校验用户名、密码,验证通过后颁发授权令牌。

请求方法

POST

请求地址

/auth/oauth2/token

请求参数

参数
参数位置
类型
是否必填
描述
client_id
Query
String
客户端 ID,可参考 应用管理页面 > 选定指定应用 > 单击应用配置 > 对应的“Client Id”
grant_type
Query
String
固定值“password”
client_secret
Query
String
客户端 Secret, 应用管理页面 > 选定指定应用 > 单击应用配置 > 对应的“Client Secret”。含有特殊字符,需要做 URLEncode
username
Query
String
用于登录 EIAM 的用户名。可能含有特殊字符,需要做 URLEncode
password
Query
String
用户名对应的密码,必须输入明文。可能含有特殊字符,需要做 URLEncode

返回参数

参数
参数位置
类型
描述
access_token
Body
String
access_token
expires_in
Body
Long
access_token 有效时间,与创建应用时设置的“access_token有效期”一致
refresh_token
Body
String
固定为空,该模式不提供 refresh_token

返回方式

重定向

接口示例

输入示例

https://<auth_domain>/auth/oauth2/token?client_id=ODQyNGJlYmFjYWFmND****wNjU4MzMxOThkMGU&grant_type=password&client_secret=oG412Uk6EdbfXtgUW****t1j%2bq&username=testuser&password=PPee3****lk!!

返回示例

{
"access_token": "c6axxxxx5c8exxxxxxxxd0fxxxxxxxxx",
"expires_in": 7200,
"refresh_token": ""
}
在二次认证功能启用的情况下,将返回
{
"error": "mfa_required",
"error_description":"mfa required",
"mfa_token": "xxxxx"
}