First introduce the authorization JS file
<script type= "Text/javascript" src= "Http://qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js" data-appid= " 101140406 "data-redirecturi=" http://127.0.0.1 "charset=" Utf-8 "></script>
Then access QQ Login
The first to use the system comes with a button login, but this will pop up a new window, do not like//Call the Qc.login method, specify the Btnid parameter to bind the button in the container node QC. Login ({//btnid: the node ID of the Insert button, required Btnid: "QQLOGINBTN",//the user needs to confirm the scope authorization entry, optional, default all scope: "All",//Press Button size, available values [a_xl| a_l| a_m| a_s| b_m| b_s| C_S], optional, default b_s size: "B_m"}, Function (Reqdata, opts) {//Login succeeded Console.log (Reqdata, opts); Depending on the return data, replace the button display state method var dom = document.getElementById (opts[' Btnid '), _logouttemplate=[//Avatar ' <span></span> ',//nickname ' <span> ; {nickname}</span> ',//exit ' <span><a href= ' JAVASCRIPT:QC. Login.signout (); " > Exit </a></span> '].join ' (""); Dom && (dom.innerhtml = QC. String.Format (_logouttemplate, {nickname:qc. String.eschtml (Reqdata.nickname),//Do XSS filtering Figureurl:reqData.figureurl}); }, function (opts) {//Logout successful alert (' QQ login logout successful '); });Two, using the custom button <a> tag link past, and then after successful call this address, a tag of the href can refer to the first Window.locationQC.api ("Get_user_info", {})//Specify the interface to access the successful receive function, s returns the response object for success. Success (function (s) {console.log (s); A successful callback to get OPENAPI's return Data alert ("Get user information successfully") via S.data The current user nickname is: "+s.data.nickname); })//Specify the interface to access the failed receive function, and F returns the response object for failure. Error (function (f) {//Failure callback alert ("Get user information failed! "); })//Specify the receive function after the interface completes the request, and C returns the response object for the completion request. Complete (function (c) {//Completion request callback alert ("Get user information complete! "); });//check whether to log in if (QC. Login.check ()) {//If QC is logged in. Login.getme (OpenID, Accesstoken) {alert (["Current Logged on user", "OpenID:" +openid, "Accesstoken as:" +accesstoken].jo In ("\ n")); }); Here you can call your own save interface//...}