Here is my plan (authorization code stream) for implementing this login / registration logic. (a third party provided the OAuth2 API )
First, the SPA will send a GET request to a third-party
GET https://www.example.com/oauth2
client_id=dummyclient
redirect_uri=https://mysite/callback
response_type=code
scope=openid
Then, if the user agrees to give his openid mysite, then fronend will receive a 301 HTTP response.
---> 301 https:
Then the browser will redirect the page to mysite/callback, and it will reload the SPA and display the code at a URL that can be captured by the SPA, after which it will send the code to a real callback.
GET https://mysite/api/real-callback?code=dummycode
, access_token. access_token, API, openid, , . , HTTP- SPA, access_token my OAuth2 401 .
, , , ( - client_id, OAuth2 . , . , access_token .) OAuth2 , āā .