Update OAuth2-Backend-Approach.md
This commit is contained in:
parent
d998ec0746
commit
17fad574ff
@ -114,19 +114,20 @@ redirect_uri=https://xorismesiti.gr/callback
|
|||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>
|
<summary>
|
||||||
|
|
||||||
<h4>Backend code</h4>
|
<h4>Backend code</h4>
|
||||||
<br><br>
|
<br><br>
|
||||||
<p>Implements the endpoint /auth/google/callback</p>
|
Implements the endpoint /auth/google/callback
|
||||||
<br>
|
|
||||||
<ul>
|
|
||||||
<li>Recieves authorization code from Google</li>
|
|
||||||
<li>POST send the authorization code to https://oauth2.googleapis.com/token</li>
|
|
||||||
<li>POST response the access & refresh tokens</li>
|
|
||||||
<li>Respond the Fronend initial request with a cookie</li>
|
|
||||||
</ul>
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
<p>1. Recieves authorization code from Google</p><br>
|
||||||
|
<p>2. POST send the authorization code to https://oauth2.googleapis.com/token</p><br>
|
||||||
|
<p>3. POST response the access & refresh tokens</p><br>
|
||||||
|
<p>4. Respond the Fronend initial request with a cookie contains the access token</p><br>
|
||||||
|
|
||||||
</summary>
|
</summary>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Backend callback URL: http://localhost:3000/auth/google/callback
|
// Backend callback URL: http://localhost:3000/auth/google/callback
|
||||||
app.get('/auth/google/callback', async (req, res) => {
|
app.get('/auth/google/callback', async (req, res) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user