M
M
Maxim Nikulin2016-08-10 07:25:29
Facebook
Maxim Nikulin, 2016-08-10 07:25:29

How to organize authentication in SPA with react and react-router?

Hello.
There is a page of participants, you need to organize voting with authentication through social networks.
For oauth, you need to create a redirect page where info from the social network will come.
I do this:
1.Created a separate route for the redirect.
2. When I click on the button to vote, I send the user via a link to the authorization window, the link is in the
facebook documentation
3. Upon successful authorization, a redirect occurs to the window my route created in step one
4. The parameters requested during authorization are sent to the url of my window
5. I send a request to the server with these parameters and I get an answer whether it is possible to vote or not.
Actually the question: When redirecting from the authorization window to the window created in step 1, it creates a new instance of my application and I do not have access to the main window where the button was pressed.
Can I somehow get this access?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question