OAuth2/access token

跳转到: 导航, 搜索
(URL)
第1行: 第1行:
==OAuth2/access_token==
+
==oauth2/access_token==
access_token接口
+
OAuth2的access_token接口
  
 
==URL==
 
==URL==
:https://api.weibo.com/oauth2/access_token
+
https://api.weibo.com/oauth2/access_token
  
 
==HTTP请求方式==
 
==HTTP请求方式==
 
POST
 
POST
==请求参数==
 
  
 +
==请求参数==
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color: #CCCCCC;"
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color: #CCCCCC;"
 
|-
 
|-
第15行: 第15行:
 
!width="20%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|类型及范围
 
!width="20%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|类型及范围
 
!width="65%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|说明
 
!width="65%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|说明
{{api_args|client_id|true|string|申请应用时分配的AppKey}}
+
{{api_args|client_id|true|string|申请应用时分配的AppKey。}}
{{api_args|client_secret|true|string|申请应用时分配的AppSecret}}
+
{{api_args|client_secret|true|string|申请应用时分配的AppSecret。}}
{{api_args|grant_type|true|string|请求的类型,可以为:authorization_code ,password,refresh_token}}
+
{{api_args|grant_type|true|string|请求的类型,可以为authorization_code、password、refresh_token。}}
 
|}
 
|}
  
*grant_type为authorization_code时
+
 
 +
;'''grant_type为authorization_code时'''
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color: #CCCCCC;"
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color: #CCCCCC;"
 
|-
 
|-
第27行: 第28行:
 
!width="20%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|类型及范围
 
!width="20%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|类型及范围
 
!width="65%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|说明
 
!width="65%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|说明
{{api_args|code|true|string|调用authorize获得的code值}}
+
{{api_args|code|true|string|调用authorize获得的code值。}}
{{api_args|redirect_uri|true|string|回调地址,需需与注册应用里的回调地址一致}}
+
{{api_args|redirect_uri|true|string|回调地址,需需与注册应用里的回调地址一致。}}
 
|}
 
|}
*grant_type为password时
+
 
 +
 
 +
;'''grant_type为password时'''
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color: #CCCCCC;"
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color: #CCCCCC;"
 
|-
 
|-
第37行: 第40行:
 
!width="20%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|类型及范围
 
!width="20%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|类型及范围
 
!width="65%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|说明
 
!width="65%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|说明
{{api_args|username|true|string|授权用户的用户名}}
+
{{api_args|username|true|string|授权用户的用户名。}}
{{api_args|password|true|string|授权用户的密码}}
+
{{api_args|password|true|string|授权用户的密码。}}
 
|}
 
|}
*grant_type为refresh_token时
+
 
 +
 
 +
;'''grant_type为refresh_token时'''
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color: #CCCCCC;"
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color: #CCCCCC;"
 
|-
 
|-
第47行: 第52行:
 
!width="20%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|类型及范围
 
!width="20%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|类型及范围
 
!width="65%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|说明
 
!width="65%" style="text-align:center;font-weight:bolder;border:1px solid #cccccc"|说明
{{api_args|refresh_token|true|string|获取到的刷新token}}
+
{{api_args|refresh_token|true|string|获取到的刷新token。}}
 
|}
 
|}
==返回数据==
 
返回数据为json格式
 
  
 +
==返回数据==
 +
<pre>
 
  {
 
  {
       "access_token":"ACCESS_TOKEN",
+
       "access_token": "ACCESS_TOKEN",
       "expires_in":1234,
+
       "expires_in": 1234,
       "refresh_token":"REFRESH_TOKEN"
+
       "refresh_token": "REFRESH_TOKEN"
 
  }
 
  }
 +
</pre>
 +
 +
 +
 +
__NOTOC__

2011年12月9日 (五) 15:21的版本

oauth2/access_token

OAuth2的access_token接口

URL

https://api.weibo.com/oauth2/access_token

HTTP请求方式

POST

请求参数

  必选 类型及范围 说明
client_id true string 申请应用时分配的AppKey。
client_secret true string 申请应用时分配的AppSecret。
grant_type true string 请求的类型,可以为authorization_code、password、refresh_token。


grant_type为authorization_code时
  必选 类型及范围 说明
code true string 调用authorize获得的code值。
redirect_uri true string 回调地址,需需与注册应用里的回调地址一致。


grant_type为password时
  必选 类型及范围 说明
username true string 授权用户的用户名。
password true string 授权用户的密码。


grant_type为refresh_token时
  必选 类型及范围 说明
refresh_token true string 获取到的刷新token。

返回数据

 {
       "access_token": "ACCESS_TOKEN",
       "expires_in": 1234,
       "refresh_token": "REFRESH_TOKEN"
 }