Transferred from:http://www.pengyaou.com/LegendsZ/File/2014/08/25/20140825100811471.html
Introduced in the website QQ and Sina Weibo landing, the threshold of the site to reduce the decline has been done, because this 2 is basically all the network name, especially QQ. Download the following 2 ways to sign in.
1.QQ requires certification and creates application applications. Such as:
Click on the website, fill in the website information, such as:
Click Create app, wait for approval, after approval we can use the basic API. The following is a list of QQ interconnect APIs.
Here is the calling code:
//introduction of JS script<script type= "Text/javascript" src= "Http://qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js" data-appid= " 101044974 "charset=" Utf-8 ">//Introduce the login button and the callback function:<span style= "margin-left:10px; margin-top:60px!important; Float:left; "ID= "Qq_login_btn" data-role= "None" > </span> <script type= "Text/javascript" >QC. Login ({btnid:"Qq_login_btn", Scope:"All", }, function() {Qc.api ("Get_user_info"). Success (function(s) {varparas ={format:"JSON" }; Qc.api ("Get_info", paras). Success (function(w) {vardata =eval (w.data); varWeibourl = "http://t.qq.com/"Data.data.name; varLC =data.data.location; }). Error (function(e) {}). Complete (function(c) {//completing the request callback varNickname = S.data.nickname;//appellation varUserqqsmallimage = s.data.figureurl_qq_1;//the QQ avatar URL size is 40x40 pixels. Userqqlargeimage = s.data.figureurl_qq_2;//the QQ avatar URL size is 100x100 pixels. varUserqqzoneimage = S.data.figureurl_1;//qq space picture url with size 50x50 pixels }); }); }); </script>
Demo Address: http://www.pengyaou.com/LegendsZ/Images/FileImage/QQLoginDemo.html
2. Sina Weibo:
Login Sina Weibo open platform, click to enter the Management center, click Add Site, first verify the site ownership, verification will be in my site, not online column to add just we fill in the site, and then need to submit the audit, Audit completed after the AppID can be used.
Detailed interface information:
Http://open.weibo.com/wiki/%E5%BE%AE%E5%8D%9AAPI
Login button Introduction and code:
//Introducing JS<script src= "Http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=APPKEY" type= "Text/javascript" charset= "Utf-8" ></script>//Login button and callback function<wb:login-button type= "3,2" onlogin= "Login" onlogout= "logout" style= "margin:0 auto; margin-top:50px; " > </wb:login-button> <script type= "Text/javascript" >functionLogin (o) {//$.ajax ({type:"Get", URL:"Https://api.weibo.com/2/users/show.json?source=2890452764&screen_name=" O.screen_name "", DataType:"Jsonp", Success:function(data) {varLC =data.data.location; varNickname = O.screen_name;//appellation varUserqqlargeimage = O.avatar_large;//Big head Image varWeibourl = "http://weibo.com/u/" O.IDSTR;//Weibo address}, Error:function(XHR, MSG, e) {alert (msg);} }); } functionLogout () {alert (' Logout '); } </script>
Demo Address: http://www.pengyaou.com/LegendsZ/eg/sinaLoginDemo.html
QQ Login and Sina Weibo login method is very similar, the steps are the same. Basically is to apply for authentication, introduce code, receive callback, log off. If you need to use some of the more advanced APIs, we need to apply separately. There is no introduction here.
"Utilities" website introduces QQ login and Sina Weibo login