QQ Authorized login of third party login

Source: Internet
Author: User

Because the development project has the use of third-party login technology, so the study, the process summarized, convenient for later use, but also to provide a reference, there is no place, I hope you point out, do this test premise is that you have a can connect to the public network server or cloud server can, also need a domain name , I am here to deploy the test site to the Sina cloud above, create your test site, and record the access address.

The first step: Enter the QQ Internet (http://connect.qq.com/), and log in, it is necessary to note that the official website to the proposal is the use of the company's public QQ number, so as to avoid the employee after leaving QQ number can not use the problem, of course, I am here to do the test, Just use your QQ number to log in.

Step two: When you log in, you can go to the Admin center.

Then choose Create App Here I choose the site, of course, can also choose mobile app

Then there will be a Web site related information form to you to submit the above recorded on the domain name will be used up, the site address and callback address are filled in the site home can, the other can be arbitrary fill, the following gives me fill out the sample, callback address, is your authorization to jump to the page after the success, Usually set as the homepage of the website or user management page


After filling out you will find still can not create the application, this is not the site has a problem, but you have a step did not do, now you put the mouse pointer to the verification button do not click, you will find pop-up to a drop-down box

Copy the contents of the tags into the head tag of your site's home page

Deploy to the server, click Start Validation, click Create app after verification is successful, and then an app is created successfully. Next we need to configure the co-developer account, otherwise you will not be able to test, configuration, account separated by commas



You can go to the official website to download the SDK, the address is (Http://wiki.connect.qq.com/sdk%E4%B8%8B%E8%BD%BD) I use the choice is Java, of course, the official has provided several ways of intervention, It's good to choose what suits you.

Step three: Unpack the downloaded SDK and open the sdk4j_ in eclipse The three Java files in the Com.qq.connect.demo package in the demo are copied to your project, the qqconnectconfig.properties files are copied to the SRC directory, the Sdk4j.jar is imported into the project, my directory structure

To modify the configuration file qqconnectconfig.properties, you only need to modify the previous four items.
The third item is the configuration of the callback address
The fourth scope is to configure permissions, I only configure the permission to get the user information here

app_id = Fill in your appidapp_key here = fill in your Appkeyredirect_uri =/http1.Linchaobbs. Sinaapp. com/afterloginredirectservlet. ActionScope = Get_user_infobaseurl = Https://graph. QQ. com/getuserinfourl = Https://graph. QQ. com/user/get_user_infoaccesstokenurl = Https://graph. QQ. com/oauth2. 0/tokenauthorizeurl = Https://graph. QQ. com/oauth2. 0/authorizegetopenidurl = Https://graph. QQ. com/oauth2. 0/meaddtopicurl = Https://graph. QQ. com/shuoshuo/add_topicaddblogurl = Https://graph. QQ. com/blog/add_one_blogaddalbumurl = Https://graph. QQ. com/photo/add_albumuploadpicurl = Https://graph. QQ. com/photo/upload_piclistalbumurl = Https://graph. QQ. com/photo/list_albumaddshareurl = Https://graph. QQ. com/share/add_sharecheckpagefansurl = Https://graph. QQ. com/user/check_page_fansaddturl = Https://graph. QQ. com/t/add_taddpicturl = Https://graph. QQ. com/t/add_pic_tdelturl = Https://graph. QQ. com/t/del_tgetweibouserinfourl = Https://graph. QQ. com/user/get_infogetweibootheruserinfourl = Https://graph. QQ. com/user/get_other_infogetfanslisturl = Https://graph. QQ. com/relation/get_fanslistgetidolslisturl = Https://graph. QQ. com/relation/get_idollistaddidolurl = Https://graph. QQ. com/relation/add_idoldelidolurl = Https://graph. QQ. com/relation/del_idolgettenpayaddrurl = Https://graph. QQ. com/cft_info/get_tenpay_addrgetrepostlisturl = Https://graph. QQ. com/t/get_repost_listversion =2.0. 0. 0

The next modification to the XML configuration is primarily the configuration XML

<?xml version= "1.0" encoding= "UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns= "Http://java.sun.com/xml/ns/javaee" xsi:schemalocation="Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3 _0.xsd " id=" webapp_id " version=" 3.0 ">  <display-name>Testsite</display-name>  <servlet>    <servlet-name>Indexservlet</servlet-name>    <servlet-class>Com.qq.connect.demo.IndexServlet</servlet-class>  </servlet>  <servlet-mapping>    <servlet-name>Indexservlet</servlet-name>    <url-pattern>/indexservlet.action</url-pattern>  </servlet-mapping>    <servlet>    <servlet-name>Afterloginredirectservlet</servlet-name>    <servlet-class>Com.qq.connect.demo.AfterLoginRedirectServlet</servlet-class>  </servlet>  <servlet-mapping>    <servlet-name>Afterloginredirectservlet</servlet-name>    <url-pattern>/afterloginredirectservlet.action</url-pattern>  </servlet-mapping>  <welcome-file-list>    <welcome-file>Index.html</welcome-file>    <welcome-file>Index.htm</welcome-file>    <welcome-file>index.jsp</welcome-file>    <welcome-file>Default.html</welcome-file>    <welcome-file>Default.htm</welcome-file>    <welcome-file>default.jsp</welcome-file>  </welcome-file-list></Web-app>

The next step is to add a login button to the page

<a href="IndexServlet.action"><img src="Connect_logo_1.png" onclick=""></a>

Deploy your code to the cloud to start testing



OK, here's the test done.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

QQ Authorized login of third party login

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.