Oauth2/authorize
(→Display说明) |
|||
第1行: | 第1行: | ||
==OAuth2/authorize== | ==OAuth2/authorize== | ||
authorize接口 | authorize接口 | ||
+ | |||
==URL== | ==URL== | ||
:https://api.weibo.com/oauth2/authorize | :https://api.weibo.com/oauth2/authorize | ||
第6行: | 第7行: | ||
==HTTP请求方式== | ==HTTP请求方式== | ||
GET/POST | GET/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;" |
2011年12月9日 (五) 13:48的版本
目录 |
OAuth2/authorize
authorize接口
URL
HTTP请求方式
GET/POST
请求参数
必选 | 类型及范围 | 说明 | |
---|---|---|---|
client_id | true | string | 申请应用时分配的AppKey |
redirect_uri | true | string | 授权后的回调地址,站外应用需与回调地址一致,站内应用需要填写canvas page的地址 |
response_type | false | string | 支持的值包括 code 和token 默认值为code |
state | false | string | 用于保持请求和回调的状态。在回调时,会在Query Parameter中回传该参数 |
display | false | string | 授权页面类型 可选范围: default,mobile,popup,wap1.2,wap2.0,js,apponweibo |
Display说明
说明 | |||
---|---|---|---|
default | 默认授权页面 | ||
mobile | 支持html5的手机 | ||
popup | 弹窗授权页 | ||
wap1.2 | wap1.2页面 | ||
wap2.0 | wap2.0页面 | ||
js | js-sdk 专用 授权页面是弹窗,返回结果为js-sdk回掉函数 | ||
apponweibo | 站内应用专用,站内应用不传display参数,并且response_type为token时,默认使用改display.授权后不会返回access_token,只是输出js刷新站内应用父框架 |
返回数据
- response_type为code
必选 | 类型及范围 | 说明 | |
---|---|---|---|
code | true | string | 用于调用access_token接口获取授权后的access token |
state | false | string | 如果传递参数,会回传该参数 |
- response_type为token
必选 | 类型及范围 | 说明 | |
---|---|---|---|
access_token | true | string | 用来调用其它api的授权过的accesstoken |
expires_in | true | string | accesstoken有效期时间,unix timestamp格式 |
refresh_token | false | string | 刷新token,如果有获取权限则返回 |
state | false | string | 如果传递参数,会回传该参数 |
示例
- response_type为token
- 请求
- https://api.t.sina.com.cn/oauth2/authorize?client_id=123050457758183&redirect_uri=http://www.example.com/response&response_type=token
- 同意授权后会重定向
- http://www.example.com/response#access_token=ACCESS_TOKEN&expires_in=250327040&refresh_token=REFRESH_TOKEN
- response_type为code