Simple implementation of third-party login by QQ and Sina Weibo, and third-party login by Sina Weibo
I. Weibo third-party Login
0, go to the development platform to complete the developer authentication: http://open.weibo.com/developers/basicinfo to create a sample application, get APPKey
1. There are two login Methods: js + html and WBML deployment. Take js + html as an example. After applying for the APPKey, introduce js and replace the appkey parameter.
<script src=http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=3343891779
type="text/javascript" charset="utf-8"></script>
2. Deploy html and js
<Div id = "wb_connect_btn"> </div> WB2.anyWhere (function (W) {W. widget. connectButton ({id: "wb_connect_btn", type: "3,1", callback: {login: function (o) {// callback function after logon}, logout: function () {// callback function after exiting }}});});
3, wbml method, please refer to the document: http://open.weibo.com/wiki/Weibo-JS_V2
4, The effect: http://www.i94web.com/
2. log on to a third party via QQ
0. Register as a developer: http://connect.qq.com/manage/reg, and create a web application
1. After obtaining the appkey, refer to js-sdk documentation: http://wiki.connect.qq.com/%E7%BD%91%E7% AB %99%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B
2. Reference js and replace "APPID" in the following code with the appid obtained when you apply for access to QQ logon.
<script type="text/javascript" src=http://qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js
data-appid="APPID" charset="utf-8"></script>
3. Insert the QQ logon button on the html page and paste the following code:
<Span id = "qqLoginBtn"> </span> <script type = "text/javascript"> QC. login ({btnId: "qqLoginBtn" // node id of the insert button}); </script>
4, The effect: http://www.i94web.com/
Original article: http://www.ido321.com/1471.html