2/oauth2/authorize/en

跳转到: 导航, 搜索

oauth2/authorize

Authorize interface of OAuth2.

URL

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

HTTP Request Method

GET/POST

Request Parameters

  Requires Type and Range Description
client_id true string AppKey created when a application is created.
redirect_uri true string Authorization callback address.Application outside the website need to be the same with the setted callback address,and application inside the website need to be the canvas page URL.
response_type false string Returned type.Supports code,token.Default is code.
state false string State for keeping request and callback.It will be returned in Query Parameter when callback.
display false string Terminal type of the authorization page.The value is as follows.


display description:
Parameter value Type Description
default Default authorization page.Apply to the web browser.
mobile Mobile termination authorization page.Apply to the mobile phone

that supports html5.

popup Popup window type authorization page.Apply to the small window web browser.
wap1.2 Wap1.2 authorization page.
wap2.0 Wap2.0 authorization page.
js Weibo JS-SDK special authorization page.Popup window type.The returned data is JSONP callback function.
apponweibo Default authorization page of the application inside the website.授权后不返回access_token,只刷新站内应用父框架。

返回数据

response_type为code
返回值字段 字段类型 字段说明
code string 用于调用access_token,接口获取授权后的access token。
state string 如果传递参数,会回传该参数。


response_type为token
返回值字段 字段类型 字段说明
access_token string 用来调用其它接口的授权过的accesstoken。
expires_in string accesstoken有效期时间,unix的timestamp格式。
refresh_token string 刷新token,如果有获取权限则返回。
state 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
//请求
https://api.t.sina.com.cn/oauth2/authorize?client_id=123050457758183&redirect_uri=http://www.example.com/response&response_type=code

//同意授权后会重定向
http://www.example.com/response&code=CODE