1.28.20 OAuth

优质
小牛编辑
125浏览
2023-12-01

OAuth related api supported by FDS

Version: 1.0.0

/

GET

Summary:

获取OAuth存储令牌

Description:

OAuth认证,使用OAuth认证前请仔细阅读FDS相关文档,并给我们发送申请邮件

Parameters
NameLocated inDescriptionRequiredSchema
storageAccessTokenquery占位符,不需要有值Yesstring
appIdquery在dev.xiaomi.com上申请的appIdYesstring
oauthAccessTokenquery通过三方OAuth认证获取的访问令牌Yesstring
oauthOpenIdquery通过XiaoMiOAuth认证时必须包含,用户的OpenIDNostring
oauthAppIdquery通过三方OAuth认证对应的appIdYesstring
oauthProviderquery三方OAuth,可以是XiaoMi, QQ, Sina, RenRenYesstring
oauthMacKeyquery通过XiaoMiOAuth认证时必须包含,在获取授权码时返回的签名密钥Nostring
oauthMacAlgorithmquery通过XiaoMiOAuth认证时必须包含,在获取授权码时返回的签名算法Nostring
Responses
CodeDescriptionSchema
200获取的OAuth存储令牌StorageAccessTokenResult

Models

StorageAccessTokenResult

NameTypeDescriptionRequired
tokenstring由FDS生成的访问令牌No
expireTimelong有效期限(1周)No

命令行示例

curl --request GET \
  --url 'https://cnbj0.fds.api.xiaomi.com/?storageAccessToken=&appId=2882303761517436430&oauthAppId=2882303761517454151&oauthAccessToken=V2xxxxhcQ&oauthProvider=XiaoMi&oauthMacAlgorithm=HmacSHA1&oauthMacKey=I60xxxxdo' \
  --header 'cache-control: no-cache'
< HTTP/1.1 200 OK
< Server: Tengine
< Date: Sat, 04 Feb 2017 09:46:25 GMT
< Content-Type: application/json
< Content-Length: 167
< Connection: keep-alive
< Access-Control-Allow-Credentials: true
< Access-Control-Max-Age: 1728000
< Access-Control-Allow-Methods: GET, POST, PUT, HEAD, DELETE, OPTIONS
< Access-Control-Allow-Headers: DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,Content-MD5
< Access-Control-Expose-Headers: content-md5, upload-time, x-xiaomi-meta-content-length
< 
* Connection #0 to host files.fds.api.xiaomi.com left intact
* Closing connection #0
{"expireTime":1486806381536,"token":"2idxxxAO"}