"Demo" Qq,github, Weibo third party social login

Source: Internet
Author: User
Tags oauth openid

This article focuses on integrated third-party social account login

Why does this need to be?

Mainly because the number of Internet sites is too many, if at each site to register an account user is very difficult to remember the user name and password for each account, and it is very hard to ensure that each account password is safe enough

Now popular social networking sites are basically every user has an account, if you log in through such a social network to get the following benefits

    • Users no longer have to sign up for other accounts

    • Users can only maintain the social account is safe enough, the use of this social account login is safe

What are the common third-party social accounts?
    • Qq

    • Sina Weibo

    • Renren Network

    • Baidu

    • Github

How do I add a third-party login feature?

These relatively large domestic social companies have a dedicated open platform, experienced developers can see the open platform can be achieved, I mainly achieve three social login

    • Sina Weibo Login

    • QQ Login

    • GitHub Login

Apply for Sina Weibo Web application

Access to http://open.weibo.com/application Web application, Weibo application can be applied first, and then submit the audit after the online






Apply for QQ Login application

Enter the https://connect.qq.com/, login after the application management, QQ application needs to be approved before the use (PS: I was rejected 4 times before, many items and record information related)





Request a GitHub Login app

Enter https://github.com/login to enter the Settings page






Implementation of QQ, Weibo, GitHub login function related data sheet
create table  ' user '   (   ' uid '  int (one)  unsigned not null auto_ increment comment  ' user uid ',   ' nickname '  varchar ( not null default)   '  COMMENT  ' user nickname ',   ' Unique_name '  varchar  not null default   '  COMMENT  ' uniquely identifies ',   ' Avatar '  varchar ($)  NOT NULL DEFAULT  '  COMMENT  ' user avatar ',   ' mobile '  varchar (one)  NOT NULL DEFAULT  '  COMMENT  ' user mobile number ',   ' updated_time '  timestamp NOT NULL DEFAULT  ' 0000-00-00 00:00:00 '  COMMENT  ' last update time ',   ' Created_time '  timestamp not  NULL DEFAULT  ' 0000-00-00 00:00:00 '  COMMENT  ' insertion time ',   primary key   (' uid '),  unique key  ' idx_name '   (' unique_name '))  ENGINE=InnoDB   Default charset=utf8&nbSp comment= ' User table '; create table  ' Oauth_token '   (   ' id '  int (one)  unsigned not null  AUTO_INCREMENT,   ' Client_type '  varchar  NOT NULL DEFAULT  '   comment  ' client source type ',   ' token '  varchar ( NOT NULL DEFAULT  ',    ' note '  varchar  NOT NULL DEFAULT  '  COMMENT  ' remarks ',   ' Valid_to '  timestamp NOT NULL DEFAULT  ' 0000-00-00 00:00:00 '  COMMENT  ' Expiration date ',   ' updated_time '  timestamp NOT NULL DEFAULT  ' 0000-00-00  00:00:00 '  COMMENT  ' last update time ',   ' Createdt_time '  timestamp NOT NULL  default  ' 0000-00-00 00:00:00 '  COMMENT  ' insertion time ',  primary key  (' id '),   KEY  ' Client_type_token '   (' client_type ', ' token ')  engine=innodb  default  charset=utf8&nbSp comment= ' oauth token  table '; create table  ' Oauth_bind '   (   ' id '  int (one)  unsigned NOT NULL  auto_increment,   ' uid '  int (one)  NOT NULL DEFAULT  ' 0 '  COMMENT  ' User uid ',   ' Client_type '  varchar ( NOT NULL DEFAULT  '  COMMENT  ') Client ',   ' OpenID '  varchar '  NOT NULL DEFAULT  '  COMMENT  ' third party ID ',    ' extra '  text NOT NULL COMMENT  ' extra Fields ',   ' created_time '   timestamp not null default  ' 0000-00-00 00:00:00 '  COMMENT  ' insertion time ',   PRIMARY KEY  (' id '),  key  ' idx_client_type_opend_id '   (' client_type ', ' OpenID ')  engine=innodb default charset=utf8 comment= ' third-party login binding relationship ';
Implementing the Schema

Related code file: Https://github.com/apanly/dream/tree/master/common/service/oauth

Clientservice.php Unified third-party login method, application Method portal githubservice.php GitHub third-party login related methods qqservice.php QQ third-party login related methods weiboservice.php Weibo third-party login related methods


Example Demo

Address: Http://www.vincentguo.cn/oauth/login, interested people can go to try on their own





integration into commercial products where optimization is needed

Get the relevant logic of user information and put it into queue processing, because getting information is still relatively slow



Original address: "Demo" Qq,github, Weibo third party social login
Tags: qq weibo oauth third-party login

"Demo" Qq,github, Weibo third party social 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.