Update OAuth2-Backend-Approach.md

This commit is contained in:
Ste Vaidis 2025-01-07 15:08:12 +02:00
parent 6f01713c56
commit 6c1d90b0f5

View File

@ -35,7 +35,7 @@ A way for the `user` to tell `google` to give an access to `xorismesiti.gr` app
3. Google **response** to Back with profile data 3. Google **response** to Back with profile data
4. Back **response** to Front with profile data 4. Back **response** to Front with profile data
<br><br> <br><br><br>
@ -66,6 +66,7 @@ Content-Length: 0
*Security: the state string should be validated upon receiving the response from Google, as it ensures that the response corresponds to the request.* *Security: the state string should be validated upon receiving the response from Google, as it ensures that the response corresponds to the request.*
<br><br><br>
@ -100,7 +101,11 @@ client_secret=PASS1234
"scope": "email profile" "scope": "email profile"
} }
``` ```
### 3. Back **response** to Front
### 3. Backend **response** to Front
<details>
<summary><h4>Backend code</h4></summary>
```js ```js
// Backend callback URL: http://localhost:3000/auth/google/callback // Backend callback URL: http://localhost:3000/auth/google/callback
@ -134,8 +139,9 @@ app.get('/auth/google/callback', async (req, res) => {
}); });
``` ```
</details>
<br><br><br>
@ -175,7 +181,7 @@ curl -X GET "https://www.googleapis.com/oauth2/v3/userinfo" \
} }
``` ```
### 4. Back **response** to Front with profile data ### 4. Backend **response** to Front with profile data
``` ```
{ {