新浪微博授權發布 WebView Android

來源:互聯網
上載者:User
Web應用登入步驟(http://open.weibo.com/wiki/Oauth2):

1、在http://open.weibo.com/註冊一個應用,然後編輯“應用資訊”-->“進階資訊”的“OAuth2.0授權設定”,設定授權回調頁面;

2、修改黃色地區的值,並用WebView進行載入;

“https://api.weibo.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=YOUR_REGISTERED_REDIRECT_URI”

3、在WebViewClient的onPageStarted方法中,截取網頁跳轉,擷取code內容;

4、同樣修改黃色地區的內容,以獲得ACCESS_TOKEN的值;

https://api.weibo.com/oauth2/access_token?client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&grant_type=authorization_code&redirect_uri=YOUR_REGISTERED_REDIRECT_URI&code=CODE

效果如下:

 

原始碼下載:SinaWeibo.rar

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.