Oauth/authorize/en

Jump to: navigation, search

Contents

oauth/authorize

After retrieve Request Token, it requires user’s authentication for the Request Token

URL

http://api.t.sina.com.cn/oauth/authorize

Formate

OAuth return formate

HTTP Request Method

GET

Rating limitation

false

Request Parameter

  • Refer to OAuth Protocol Section 6 http://oauth.net/core/1.0a/#anchor9
    Parameter is required if XML/JSON formate is used. (See details blow)
  • oauth_token oauth token retrieved by previous step
  • oauth_callback, encoded by url encode.json or xml(for mobile devices)
  • display, define the display type. There are 5 display type
    web:display=page this is default value
    wap:display=wap server can determinate whether wap 1.2 or 2.0 is used by the header
    wap1.2:display=wap1.2 for wap1.2
    wap2.0:display=wap2.0 for wap 2.0
    popup:display=popup
  • userId , user name of Sina account
  • passwd : password

Usage

  • When Request Parameter oauth_callback is set to oob, it means this is a desktop application, there are a lot of methods to authenticate. Some mobile devices don’t support Web/WAP, to authenticate:
  • oauth_callback=json, return the parameter directly
{"oauth_token":"c248561721393a78260b8d00ece7d703", "oauth_verifier":"234256"}
  • oauth_callback=xml, return the parameter directly:
<oauth_token>c248561721393a78260b8d00ece7d703</oauth_token>
<oauth_verifier>234256</oauth_verifier>

Example

PHP Example

Please download PHP SDK with OAUTH supported from Weibo SDK Development Kit Dowload Site
. Sample Code:

//oauth/authorize
$o = new WeiboOAuth( WB_AKEY , WB_SKEY  );
$keys = $o->getRequestToken();
$aurl = $o->getAuthorizeURL( $keys['oauth_token'] ,false , 'http://localhost/callback.php');
echo($aurl);
文档更新时间: 21 January 2011