QQ logon and qq Logon

Source: Internet
Author: User
Tags openid

QQ logon and qq Logon

First introduce the authorized 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>

Connect to QQ to log on.


First, use the built-in button to log on, but this will pop up a new window and do not like // call QC. login method. Specify the btnId parameter to bind the button to the container node QC. login ({// btnId: node id of the insert button, required: btnId: "qqLoginBtn", // scope authorization item to be confirmed by the user, optional, default: all scope: "all ", // button size. Available values: [A_XL | A_L | A_M | A_S | B _M | B _S | C_S]. Optional. default values: B _S size: "B _M"}, function (reqData, opts) {// log on to the console successfully. log (reqData, opts); // Based on the returned data, change the button to display the status method var dom = document. getElementById (opts ['btnid']), _ logoutTemplate = [// profile picture '<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), // perform xss filtering figureurl: reqData. figureurl}) ;}, function (opts) {// alert ('qq login logout successfully') ;}); second, use the Custom button <a> to link the tag and call this address after the tag is successfully linked. For the href of tag a, refer to the first type w Indow. locationQC. api ("get_user_info", {}) // specify the receiving function for which the interface is successfully accessed. s indicates that the Response object is returned successfully. success (function (s) {console. log (s); // success callback, through s. alert ("user information retrieved successfully! Current user nickname: "+ s. data. nickname) ;}) // specifies the receiving function for interface access failure. f indicates the Response object returned for failure. error (function (f) {// failed callback alert ("failed to get user information! ");}) // Specifies the receiving function after the interface completes the request. c returns the Response object for the completion request. complete (function (c) {// complete the request callback alert ("the user information has been obtained! ") ;}); // Check whether to log on to if (QC. login. check () {// if you have logged on to QC. login. getMe (function (openId, accessToken) {alert (["Current logon user", "openId:" + openId, "accessToken:" + accessToken]. join ("\ n") ;}; // you can call your own save interface here //...}



How can I access QQ logon on a website similar to the discuz forum?

Go to the QQ Open Platform and you will see website access. Copy the Website access code and place it in the appropriate location as required by the open platform.

How can I access QQ to log on to a website? Detailed code

To use the tx interface, you must verify the password database of tx qq when logging on with qq. Therefore, you only need one interface and one link.
 

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.