Update OAuth2-Backend-Approach.md

This commit is contained in:
Ste Vaidis 2025-01-07 15:03:31 +02:00
parent de22182f22
commit 8b780a97eb

View File

@ -143,13 +143,23 @@ app.get('/auth/google/callback', async (req, res) => {
# 3. Use Token # 3. Use Token
1. Front **GET** profile data from Back `https://xorismesiti.gr/api/auth/profile` using the `cookie` ### 1. Frontend **GET** profile data from Backend
2. Back **GET** profile data from Google `https://www.googleapis.com/oauth2/v3/userinfo` using the `access_token` from Front `cookie`
3. Google **response** to Back with profile data
4. Back **response** to Front with profile data
```bash
curl -X GET https://xorismesiti.gr/api/auth/profile \
-H "Cookie: access_token=ya29.a0AfH6SMC8Op6zXZkHi2XITkDoOVzYXt3hTY6sny54UlWlxrnKlX5Xv78is7BEHekVX-VoA" \
-H "Accept: application/json"
```
3. Google **response** to Back with profile data ### 2. Backend **GET** profile data from Google `https://www.googleapis.com/oauth2/v3/userinfo` using the `access_token` from Front `cookie`
```bash
curl -X GET "https://www.googleapis.com/oauth2/v3/userinfo" \
-H "Authorization: Bearer {access_token}" \
-H "Accept: application/json"
```
### 3. Google **response** to Back with profile data
``` ```
{ {
@ -165,9 +175,7 @@ app.get('/auth/google/callback', async (req, res) => {
} }
``` ```
### 4. Back **response** to Front with profile data
4. Back **response** to Front with profile data
``` ```
{ {