B
B
Boris2019-08-21 15:57:05
JavaScript
Boris, 2019-08-21 15:57:05

How to organize authorization through a social network on a mobile phone when a request is intercepted by a native social network application?

Faced such a problem: when users from a smartphone (at least, android) try to enter the site through a social network, clicking on the login link intercepts the native FB or VK application (though not for everyone and not in all browsers), the social network confirms the entrance, but the frontend can't process the data.
I have a SPA that communicates with the backend via rest-api, stateless. Login through the social network is organized through the backend: the user opens a new window, there he confirms the login, redirects to my service page, where I confirm the login and give the api-key and information about the user in json. The frontend takes it and closes the window.
Everything worked fine while working through the browser. When the request is intercepted by the native social network application, then after confirming the request, the user sees my service page, but the frontend does not see it, because it is open in the social network application, and not in the browser.
What to do with it - I do not understand yet.
Who has experienced this? Or what are more competent ways to organize an entrance through a social network?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Talalaev, 2019-08-22
@neuotq

Service worker - promise.
The service worker is running, the promise is waiting and catching the event from the server.
Well, since you say that the user sees your service page, then in general everything works.
On the service page, you show the message "Now you are authorized and can return to the site" and create an event that you send to the front (there are running promises waiting for it). Well, then everything is the same as you are now.

S
Sergey, 2019-08-21
@gangstarcj

As an example https://developers.facebook.com/docs/facebook-logi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question