Source:http://developer.baidu.com/wiki/index.php?title=docs/oauth/authorization
Webpage
Function:authorization Code
Url:http://openapi.baidu.com/oauth/2.0/authorize
Parameters:
1.client_id
2.response_type "Code"
3.redirect_uri if success, then page turn back to this page; (if user cancel the authorization Midway, a string "error= Access_denied "would follow this URI);
4.Display I choose "Page"
Example:
Http://openapi.baidu.com/oauth/2.0/authorize?
Response_type=code
&client_id=yrlmicbrv56ccjfmws21dkqp
&redirect_uri=http%3a%2f%2fwww.lecai.com%2fuser%2fbaidu%2fcallback%2f%3freferer%3dhttp%253a%252f% 252fwww.lecai.com%252f%253fagentid%253d4200
&scope=super_msg
&display=page
After then, Baidu authorization sever build a authorization code and attach it to the Redirect_uri given in parameter be Fore. This just looks like:
Location:http://www.example.com/oauth_redirect?code=anxxsnjwqdugonqeikrmu2bkaxcdllxn
Attention:
The validity of each Authorization Code for ten minutes, and can only be used once.
Function:via Authorization Code get access token
Url:https://openapi.baidu.com/oauth/2.0/token
Parameters:
1.grant_type: "Authorization_code"
2.code:value of Authorization_code
3.client_id:api Key of app (it seems like I has no app)
4.client_secret:secret Key of App ((*_*))
5.redirect_uri:same as Redirect_uri given before
Example:
Https://openapi.baidu.com/oauth/2.0/token?
grant_type=authorization_code&
code=anxxsnjwqdugonqeikrmu2bkaxcdllxn&
client_id=va5yqrhla4fq4er3lt0vuxv4&
client_secret=0rdsjzq20xuj5itv7wrtznpqszr5pvw2&
Redirect_uri=http%3a%2f%2fwww.example.com%2foauth_redirect
+-----------------------------+-----------------+
For Mobile:
Example:
Http://openapi.baidu.com/oauth/2.0/authorize?
display=mobile&
client_id=yrlmicbrv56ccjfmws21dkqp&
response_type=code&
redirect_uri=http%3a%2f%2fh.lecai.com%2fapi%2fcooperator%2fbaidu%2flogin%2fcallback%3freferer% 3dlynwyxropxbhz2uvbwfpbg%25253d%25253d