JS How to call the QQ Interconnect API to achieve third party login

Source: Internet
Author: User
Tags openid

  This article mainly introduces JS how to call the QQ Internet API to achieve Third-party login, the need for friends can refer to the following

QQ Interconnect JS sdk:http://wiki.connect.qq.com/js_sdk%e4%bd%bf%e7%94%a8%e8%af%b4%e6%98%8e    code as follows: <script type =text/javascript>    introduced in page header: <script type= "Text/javascript"   src= "http://" Qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js "  data-appid=" AppID "data-redirecturi=" Huidiaodizhi (with HTTP)   charset= "Utf-8" ></script>    Add the following information to the body:   //Set QQ share button   QC. Login (  {  btnid: "QQLOGINBTN"//Insert button node id },  function (Reqdata, opts) {//Login Success    //According to number of returns According to the Change button display state method   var dom = document.getElementById (opts[' Btnid ']), _logouttemplate = [ //avatar   ' <span> <img src= ' {figureurl} ' class= ' {size_key} '/></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),//XSS filtering   figureurl:reqdata.figureurl }); },  Function (opts) {//Logoff Success   alert (logout successful!!) "); }); //Invoke API Authorization   QC.API (" Get_info ", { " Oauth_consumer_key ":" AppID "//This can not be passed  }). Success (function (s) {  if (QC. Login.check ()) {//Check for successful login and eject OpenID and accesstoken  QC. Login.getme (function (openId, Accesstoken) {  alert (openid+ "+accesstoken); }); } });    </script>  <div class= "Lib_tiv Shadow" >  <h3 class= "logo" >QQ login </h3>  </div> 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.