Update OAuth2-Backend-Approach.md

This commit is contained in:
Ste Vaidis 2025-01-07 15:47:57 +02:00
parent d998ec0746
commit 17fad574ff

View File

@ -114,19 +114,20 @@ redirect_uri=https://xorismesiti.gr/callback
<details>
<summary>
<h4>Backend code</h4>
<br><br>
<p>Implements the endpoint /auth/google/callback</p>
<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>
Implements the endpoint /auth/google/callback
<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>
<br><br>
```js
// Backend callback URL: http://localhost:3000/auth/google/callback
app.get('/auth/google/callback', async (req, res) => {