Think of an electronic application as a standard browser page. Then you will have a standard oauth2 stream.
First of all, you need an intermediate level server where you will store clientId and clientSecret for third-party services.
You need to create something like a session between the electronic application and the middleware server (below I will show an example).
Below I will show an example of the github authorization process.
You need to use https.
Suppose your middle-tier server is available at example.com. Your need for at least two endpoints:
Github client_id and client_secret are stored only on this server.
GET https://example.com/initAuth/.
uuid's. (, redis). uuid state github link, - /, .
url github github:
GET https://github.com/login/oauth/authorize
/ uuid URL.
target = "_ blank" - / separe. / uuid.
, oauth, . (https://example.com/oauth/token)
code state. , state. , code client_secret access_token ( - oauth).
(redis) access_token uuid's.
html- script, html .
, access_token.
- , / uuid. access_token .
- websockets
- , "oauth", access_token.
, access_token , github, , github .