android新浪微博oauth2.0,新浪微博oauth2.0(示例代码)

钮安歌
2023-12-01

1.请求用户授权:

http://open.weibo.com/wiki/Oauth2/authorize

https://api.weibo.com/oauth2/authorize?client_id=1317723116&redirect_uri=http%3a%2f%2flocalhost%3a1411%2fredirecturi.aspx&response_type=code&display=Default

2.通过code换取token(令牌)信息

http://open.weibo.com/wiki/Oauth2/access_token

responseData{"access_token":"2.00CJ4g5GeyBL8B8d5bce0712eyhtSD","remind_in":"157679999","expires_in":157679999,"uid":"5861527804"}

{"id":5861527804,"idstr":"5861527804","class":1,"screen_name":"PengsWan","name":"PengsWan","province":"32","city":"1","location":"江苏 南京","description":"","url":"","profile_image_url":"http://tva4.sinaimg.cn/crop.0.0.170.170.50/006oGn92jw8f12fcu13mqj304q04qt8h.jpg","profile_url":"u/5861527804","domain":"","weihao":"","gender":"m","followers_count":3,"friends_count":1,"pagefriends_count":0,"statuses_count":0,"favourites_count":0,"created_at":"Wed Feb 17 16:40:00 +0800 2016","following":false,"allow_all_act_msg":false,"geo_enabled":true,"verified":false,"verified_type":-1,"remark":"","ptype":0,"allow_all_comment":true,"avatar_large":"http://tva4.sinaimg.cn/crop.0.0.170.170.180/006oGn92jw8f12fcu13mqj304q04qt8h.jpg","avatar_hd":"http://tva4.sinaimg.cn/crop.0.0.170.170.1024/006oGn92jw8f12fcu13mqj304q04qt8h.jpg","verified_reason":"","verified_trade":"","verified_reason_url":"","verified_source":"","verified_source_url":"","follow_me":false,"online_status":0,"bi_followers_count":0,"lang":"zh-cn","star":0,"mbtype":0,"mbrank":0,"block_word":0,"block_app":0,"credit_score":80,"user_ability":0,"urank":4}

querystring: access_token=2.00CJ4g5GeyBL8B8d5bce0712eyhtSD

https://api.weibo.com/2/account/get_uid.json

https://api.weibo.com/2/account/get_uid.json?access_token=2.00CJ4g5GeyBL8B8d5bce0712eyhtSD

 类似资料: