M
M
Maxim Devda2018-07-27 22:36:00
JavaScript
Maxim Devda, 2018-07-27 22:36:00

Social authentication networks in the popup window. Interested in js implementation?

Made registration and login on the site through the social. networks using php. But access to user data occurs in the same window as the site itself. I saw on other sites that this happens in a window, which then closes.
I searched on google and didn't find anything. Maybe he didn't do those search queries.
The question is how can I implement this myself? If possible, an example or a link to it. Or at least in which direction to dig.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sokolov, 2018-07-27
@sergiks

OAuth2

  1. Click to open popup with social. network where login and access rights are requested.
  2. The social network, after user confirmation, redirects to the site URL with a certain temporary token.
  3. This token, once on the site server, is directly exchanged with the social. network to the user's token. Or just the site is convinced of the validity of the token - it means that the user is exactly who he claims to be.
  4. popup sends postMessage() to the main window of the site that opened it, and then it reloads or simply updates the data. Immediately after sending the message, the popup closes itself. Or it is closed by the parent window when a message is received.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question