当前位置:网站首页>Re understand oauth2.0 protocol for joint login

Re understand oauth2.0 protocol for joint login

2022-06-30 11:43:00 Full stack programmer webmaster

One 、 Define several name concepts :

  1. Authorization link : Jump to the authorization interface
  2. The function of the callback address : On the authorization page , Click to authorize ,( The authorization button is provided by a third party ), If the authorization succeeds , Will jump to the callback address , And the authorization code is passed to us as a parameter , And then get through the authorization code acctoken, Get more Openid.
  3. openid openid It is a unique and non repeated identification provided by the third-party open platform . Use Openid Combine your own website for joint login operation

Two 、oauth2.0 Agreement acquisition openid technological process

1. Generate an authorization code connection ,
2. Click to authorize ( Jump to the callback address , The authorization code is in the parameter ) Exchange for by authorization code acctoken
3. adopt acctoken Exchange for openid
4. adopt acctoken+openid In exchange for user information .

3、 ... and 、 The overall process of authorization login of associated account

  1. Jump authorization connection
  2. Authorized success , Jump to callback address , The parameters carried include authorization code , Exchange for by authorization code acctoken,acctoken Exchange for openid
  3. Use openid Query our database , If yes, it indicates that the account number has been associated before , Release login
  4. If you use openid I didn't find , Jump to the associated account page .
  5. The associated page is divided into associated pages : (1) A new account is equivalent to registering , At the same time, we should also put openId Write data ). You need to associate the account number with openid Write to the database . (2) Associate the original account , Log in first , In the Openid Write to the database .

Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/100802.html Link to the original text :https://javaforall.cn

原网站

版权声明
本文为[Full stack programmer webmaster]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/181/202206301105592197.html