​ The third-party login is based on the user on the third-party platform ( Such as WeChat ,QQ, Baidu ) Existing account to quickly complete the system login 、 register - Login and other functions .

Authentication of wechat

Take the authentication of wechat as an example :

If your website has a scanning code login function , A QR code page provided by wechat will pop up , You need to scan the code with wechat on your mobile phone , Operate , You can log in . Such as this link :

Wechat login (qq.com)

Um. . This is the quickest way to develop and use , It is also the code scanning login method used by most sites at present . But this depends on the function of wechat open platform , Wechat is the provider of authentication services , Have the obligation to supervise the websites of third parties ( Your website is a third party relative to wechat ), So you need to have a business license for the enterprise or organization , Certified , Before you can apply for this function .( It's said that you still need to pay for the certification ,OMG)

For individuals , This is clearly not a viable approach .

Then we still have two choices :

1. Authentication of wechat official account : Your web page is accessed in the wechat client , By jumping to the authentication link , An authentication page pops up , Login can be completed with one operation , Please read the official documents Web page authorization | Wechat open documents (qq.com)

This does not require certification , I think from the perspective of wechat , The browser control of wechat client is a function integrated in wechat , Have the ability to jump the control and authentication link from the legal domain name registered in the wechat background , But your website still needs to record and go https agreement

2. Wechat applet authentication : This is similar to the authentication of wechat official account , The difference is the wechat applet SDK Provides login function , Applets don't need authentication , Available information ,  Please read the official documents wx.login(Object object) | Wechat open documents (qq.com)

Third party login process

First, the user confirms the authorization actively , The third-party platform will generate a login certificate , According to the third-party platform User credentials Login credentials , return Conversation token With the user The unique account number of the third party Id, The token is used to obtain the account information of the third-party platform , For example, head portrait , nickname , Address , Phone number, etc , If the user is logging in for the first time , You can use these account information to create a system account .

Login credentials and tokens , All have timeliness

In wechat Authentication , The related concepts are :

  • Login credentials :Code
  • Conversation token :SessionKey
  • Unique account number Id:OpenId
  • User credentials :AppId、AppSecret

Think about how to implement your login logic :

The login page of the official account , And wechat applets can be accessed by scanning the code . And then through our own back-end authentication service , Similar to the following process

  1. Click the wechat applet on the web page to log in , The web page generates a Token, call getwxacode() Interface , take scene Set to Token value ,page Set as applet authentication page , Generate applet code .
  2. Users use wechat client to scan code , Enter the applet authentication page , Get... From parameters scene( Namely Token), And call the back-end interface , take Token As Key Record to the server Cache(Key/Value) in
  3. The user clicks "agree to log in" in the applet , call  wx.login() obtain Code, And call the back-end interface , Will be Code The value is entered in Token by Key Of Value in
  4. At the same time, the web page is polling and invoking the query Cache Interface to the entry , Once you get Token Corresponding Code value , Indicates completion of authorization
  5. The web page calls the third-party login interface , take Code The value is passed to the back-end service as the login credential . Call the relevant wechat third-party login interface , In exchange for SessionKey,OpenId, recycling SessionKey Query related avatars , nickname , Address , Telephone and other information return

The user's operation path :

After comparison and reflection , We use the authentication method of wechat applet with simpler calling method . Back end adoption .Net6 + Abp.Zero Quickly set up the user system , utilize Abp.Zero The integrated third-party login function can quickly realize wechat login . In order to save time, we need a ready-made wechat SDK library .

Next , Start project construction

Use Abp.Zero Build a third-party login module ( Two ): Server development - Lin Xiao lx - Blog Garden (cnblogs.com)

Use Abp.Zero Build a third-party login module ( One ): More related articles in the principle article

  1. Section 404 ,python Website third party login ,social-auth-app-django modular ,

    Section 404 ,python Website third party login ,social-auth-app-django modular , social-auth-app-django The module is dedicated to Django Third party login OAuth2 Protocol module Objective ...

  2. 3. ABP .NETCore Add an enterprise wechat third-party login

    1. Steps for enterprise wechat login 1. Get enterprise wechat Token Official documents :https://work.weixin.qq.com/api/doc#90000/90135/91039 2. adopt Token With the front end Co ...

  3. Step by step use ABP Framework build formal project series tutorial localization details

    Return to the general catalog < Step by step use ABP Framework building formal project series tutorial > This directory Talk about localization ABP Localization in Summary Talk about localization This section is about localization , It's also called internationalization . Global , Whatever it is called , Anyway, the truth is the same ...

  4. Third party login plugin .NET edition XY.OAuth-CSharp

    XY.OAuth-CSharp GitHub:XY.OAuth-CSharp OSChina:XY.OAuth-CSharp Third party login plugin .NET edition Use First , from NuGet Installation on "XY. ...

  5. About use ABP Summary of issues that need to be paid attention to when upgrading the framework construction project

    ABP General catalogue of theoretical study Step by step use ABP Framework building formal project series tutorial ABP And Module-Zero Study Directory This directory explain Upgrading method problem _01:Log4Net Causes compilation to fail 2015/12/18 to update ...

  6. QQ Third party login

    QQ Third party login stay Android In the process of application development , Many times, users need to log in / Registration module . In addition to designing the login interface by yourself and realizing the corresponding functions , Now you can also use Baidu . The third-party account login module provided by Tencent and other developer platforms . Recently studied ...

  7. CI frame QQ Interface ( Third party login interface PHP edition )

    This post has a lot of content , Most of them are source code , There is only one place to change , Others just copy the past , It works perfectly . This post is mainly aimed at CI frame , Don't download SDK, Follow my steps , Build documents , Just copy the code .10 Not for a minute , Interface . First step ...

  8. How to design App Login module ?

    1. Familiar with current common mobile phones APP Way of landing ① Account login ( mobile phone . mailbox ) ② Third party landing ( WeChat ,QQ, Microblogging ) ③ One click quick login ( Tool class , If you don't remember words ) ④ Tourists landing (bbs) ⑤ demo Test landing ( Such as the alliance of friends, etc ) ...

  9. QQ Login interface ( Third party login interface )

    CI frame QQ Interface ( Third party login interface PHP edition ) This post has a lot of content , Most of them are source code , There is only one place to change , Others just copy the past , It works perfectly . This post is mainly aimed at CI frame , Don't download SDK, Follow my steps , Build documents , Copy generation ...

  10. The evolution of the login module , Let's review java Learning process ( Two )

    And then the evolution of the previous login module , Let's review java Learning process ( One ) Go on to the following Now let's go to the login function , It's all about accomplishing this function , Directly start to write specific code in the class dealing with the actual business, and implement step by step , That's process oriented programming . ...

Random recommendation

  1. Git A detailed explanation of common orders

    Git It's a powerful distributed version management tool , It is not only suitable for managing the source code of large open source software ( Such as :linux kernel), There are also many advantages to managing private documents and source code ( Such as :wsi-lgame-pro) Git More about ...

  2. stay win8.1 Install in apache+php+mysql

    because x Project requirements , You need to learn to use php, We don't have much experience ,win8.1 The system is being built php In our operating environment , It took some trouble , But it was finally solved . Details please see original text :http://jingyan.baidu.com/ar ...

  3. error :ld returned 1 exit status

    forehead , The name of the called function is inconsistent with the name of the calling function : So there will be ld returned 1 exist status Okay , Problem solved .

  4. PHP Other common functions ;&lt;&lt;&lt; object-oriented (OPP) Three characteristics of : encapsulation 、 Inherit 、 Additive state :&gt;&gt;&gt; &lt;---- Interview questions ; Construction method 、 destructor , Magic methods 、set、get Method ; static state ; abstract class ; Interface

    PHP Other common functions :     assignment :$r->name = " Elements ";       Value : echo $r->name;  count()   Count the number of elements in an array or in an object ...

  5. linux How to set environment variables

    0. View environment variables export 1. Direct command execution , But only this session is valid export PATH=$PATH:/dir/I/want 2. modify profile file Add... To it : export PATH=& ...

  6. Use JQuery Double click Modify Table in Td

    <html> <head> <meta http-equiv="Content-Type" content="text/html;chars ...

  7. RQPro Public offering FOF Examples of strategies —— Morningstar fund screening and risk parity allocation

    2017 year 9 month 8 Japan , The CSRC announced the first batch of public offerings FOF List of funds , Marks the public offering FOF The product is officially launched .FOF(Fund of Funds) It's an investment fund , Instead of directly investing in specific securities ( Stocks or bonds, etc ) To achieve decentralized asset allocation ...

  8. Node + Selenium Use the summary

    You can refer to the steps on the Internet . For example, this article :https://wangheng3751.github.io/2018/01/17/selenium/ 1. install Node.js, Go to the official website to download the latest version of Node.j ...

  9. Vue Entry notes ( One )-- Base part

    github Address :https://github.com/iTao9354/basicVue(demo01-28) One . First time to know Vue Use double braces {{message}} Render data into DOM in .       can ...

  10. RabbmitMQ- Composition and simple use

    What is? MQ? MQ The entire Message Queue, Message queue (MQ) It's an application to application communication method .MQ Is the consumer - A typical representative of the producer model . One end keeps writing messages to the message queue while the other end can read messages from the queue . R ...