Update OAuth2-Backend-Approach.md

This commit is contained in:
Ste Vaidis 2025-01-07 15:40:06 +02:00
parent 3638fb2b1e
commit f89b52cc56

View File

@ -84,9 +84,9 @@ Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code& grant_type=authorization_code&
code=AAAABCX4XfWgyVyziyLg0QHHHHH& code=AAAABCX4XfWgyVyziyLg0QHHHHH&
redirect_uri=https://xorismesiti.gr/callback&
client_id=ABC34JHS9D& client_id=ABC34JHS9D&
client_secret=PASS1234 client_secret=PASS1234&
redirect_uri=https://xorismesiti.gr/callback
``` ```
### 2. Google **response** to Backend ### 2. Google **response** to Backend
@ -102,7 +102,7 @@ client_secret=PASS1234
} }
``` ```
### 3. Backend **response** to Frontend ### 3. Backend **response** to Frontend (for the initial request to Google)
```json ```json
{ {
@ -113,7 +113,18 @@ client_secret=PASS1234
``` ```
<details> <details>
<summary><h4>Backend code</h4></summary> <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 : authorization code to https://oauth2.googleapis.com/token</li>
<li>POST reqponse: access & refresh tokens</li>
<li>Respond the Fronend initial request with a cookie</li>
</ul>
</summary>
```js ```js
// Backend callback URL: http://localhost:3000/auth/google/callback // Backend callback URL: http://localhost:3000/auth/google/callback