Simple implementation of third-party login by QQ and Sina Weibo, and third-party login by Sina Weibo

Source: Internet
Author: User

Simple implementation of third-party login by QQ and Sina Weibo, and third-party login by Sina Weibo

I. Weibo third-party Login

0, go to the development platform to complete the developer authentication: http://open.weibo.com/developers/basicinfo to create a sample application, get APPKey

1. There are two login Methods: js + html and WBML deployment. Take js + html as an example. After applying for the APPKey, introduce js and replace the appkey parameter.

<script src=http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=3343891779

type="text/javascript" charset="utf-8"></script>

2. Deploy html and js

<Div id = "wb_connect_btn"> </div> WB2.anyWhere (function (W) {W. widget. connectButton ({id: "wb_connect_btn", type: "3,1", callback: {login: function (o) {// callback function after logon}, logout: function () {// callback function after exiting }}});});
3, wbml method, please refer to the document: http://open.weibo.com/wiki/Weibo-JS_V2

4, The effect: http://www.i94web.com/

 

2. log on to a third party via QQ

0. Register as a developer: http://connect.qq.com/manage/reg, and create a web application

1. After obtaining the appkey, refer to js-sdk documentation: http://wiki.connect.qq.com/%E7%BD%91%E7% AB %99%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B

2. Reference js and replace "APPID" in the following code with the appid obtained when you apply for access to QQ logon.

<script type="text/javascript" src=http://qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js

data-appid="APPID" charset="utf-8"></script>

3. Insert the QQ logon button on the html page and paste the following code:

<Span id = "qqLoginBtn"> </span> <script type = "text/javascript"> QC. login ({btnId: "qqLoginBtn" // node id of the insert button}); </script>
4, The effect: http://www.i94web.com/
Original article: http://www.ido321.com/1471.html

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.