OAuth API.
版本 : 2.0.0
域名 : ${domainId}.auth.aliyunpds.com
协议 : HTTPS
基础路径 : /v2
发起OAuth2.0鉴权流程
参数位置 : query参数字段 : AuthorizeRequest
https://hz0.auth.aliyunpds.com/v2/oauth/authorize?client_id=xxx&redirect_uri=https%3A%2F%2Fxxx.com&response_type=code
HTTP代码 | 说明 | 类型 |
---|---|---|
302 | 重定向到认证服务 | 无内容 |
400 | 请求参数无效 | InvalidParameterError |
403 | 无权限 | ForbiddenError |
500 | 内部错误 | InternalErrorError |
获取token
参数位置 : body参数格式 : application/x-www-form-urlencoded参数字段 : TokenRequest
# 通过code获取access_token
client_id=xxx&client_secret=xxx&code=xxxx&grant_type=code&redirect_uri=https%3A%2F%2Fxxx.com
# 通过refresh_token获取access_token
client_id=xxx&client_secret=xxx&refresh_token=xxxx&grant_type=refresh_token&redirect_uri=https%3A%2F%2Fxxx.com
# 通过jwt获取access_token
client_id=xxx&client_secret=xxx&assertion=ak******asd==&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
相关链接:通过JWT方式接入指南
HTTP代码 | 说明 | 类型 |
---|---|---|
200 | 请求成功 | AccountAccessTokenResponse |
400 | 1. 请求参数无效. 2. 请求body是无效的json格式 | InvalidParameterError |
403 | 无权限 | ForbiddenError |
500 | 内部错误 | InternalErrorError |
名称 | 说明 | 类型 |
---|---|---|
client_id 必填 |
Client ID, 此处填写创建App时返回的AppID 样例 : "aksjoiajsoias" |
string |
login_type 可选 |
鉴权方式,目前支持default,ding,ram 默认值 : "ding" 样例 : "ding" |
string |
redirect_uri 必填 |
回调地址, 此处填写创建App时填写的回调地址 样例 : "https://app.com/callback" |
string |
response_type 必填 |
返回类型, 可填写code,token 样例 : "code" |
string |
scope 可选 |
申请的权限列表, 默认为所有权限 | < string > array |
state 可选 |
用户自定义字段,会在鉴权成功后的callback带回 样例 : "string" |
string |
名称 | 说明 | 类型 |
---|---|---|
assertion 可选 |
JWT方式授权需要传此参数,传入JWT签名的声明,用于更换accessToken 样例 : "ak******asd==" |
string |
client_id 必填 |
Client ID, 此处填写创建App时返回的AppID 样例 : "aksjoiajsoias" |
string |
client_secret 可选 |
Client ID, 此处填写创建App时返回的AppSecret 样例 : "alsdklajdkxlawalwknq" |
string |
code 可选 |
认证后回调参数中的code 样例 : "cjajksadhw" |
string |
grant_type 必填 |
通过哪种方式获取accessToken, 可选值:refresh_token, authorization_code, urn:ietf:params:oauth:grant-type:jwt-bearer 样例 : "authorization_code" |
enum |
redirect_uri 可选 |
回调地址, 此处填写创建App时填写的回调地址,OAuth方式登录时需要传入 样例 : "https://app.com/callback" |
string |
refresh_token 可选 |
刷新accessToken使用的refreshToken 样例 : "aksbcjhwhq" |
string |
InvalidParameterError 参数非法错误
名称 | 说明 | 类型 |
---|---|---|
code 必填 |
样例 : "InvalidParameter" |
string |
message 必填 |
样例 : "The input parameter {parameter_name} is not valid." |
string |
InternalErrorError 内部错误
名称 | 说明 | 类型 |
---|---|---|
code 必填 |
样例 : "InternalError" |
string |
message 必填 |
样例 : "The request has been failed due to some unknown error." |
string |
名称 | 说明 | 类型 |
---|---|---|
access_token 必填 |
用于调用业务接口的accessToken 样例 : "cnskjajkahwdhwialsnd" |
string |
avatar 可选 |
当前用户头像 样例 : "cherry" |
string |
default_drive_id 可选 |
Default Drive ID 样例 : "100" |
string |
expire_time 可选 |
accessToken过期时间,ISO时间 样例 : "2019-09-01T06:57:48.813Z" |
string |
expires_in 可选 |
accessToken过期时间,单位秒 样例 : 3600 |
integer (int64) |
nick_name 可选 |
当前用户昵称 样例 : "cherry" |
string |
refresh_token 可选 |
用于刷新accessToken 样例 : "cnskjajkahwdhwialsnd" |
string |
role 可选 |
当前用户角色 样例 : "user" |
string |
state 可选 |
临时权限,用于登录成功后设置密码 样例 : "klafhjas-asdasd-asd-as-d-asd-asd-asdasd" |
string |
token_type 可选 |
accessToken类型,Bearer 样例 : "Bearer" |
string |
user_data 可选 |
用户自定义数据,格式为json,可用于配置项、少量临时数据等存储,不超过1K 样例 : "{ is_student: true }" |
< string, object > map |
user_id 可选 |
当前用户ID 样例 : "DING-xxxxx" |
string |
user_name 可选 |
当前用户名 样例 : "cherry" |
string |
ForbiddenError 被禁止错误
名称 | 说明 | 类型 |
---|---|---|
code 必填 |
样例 : "Forbidden" |
string |
message 必填 |
样例 : "User not authorized to operate on the specified APIs." |
string |