From 8b780a97ebaf585666edd3761ecf850e0357c529 Mon Sep 17 00:00:00 2001 From: Ste Vaidis Date: Tue, 7 Jan 2025 15:03:31 +0200 Subject: [PATCH] Update OAuth2-Backend-Approach.md --- OAuth2-Backend-Approach.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/OAuth2-Backend-Approach.md b/OAuth2-Backend-Approach.md index 11a3709..d5c7353 100644 --- a/OAuth2-Backend-Approach.md +++ b/OAuth2-Backend-Approach.md @@ -143,13 +143,23 @@ app.get('/auth/google/callback', async (req, res) => { # 3. Use Token -1. Front **GET** profile data from Back `https://xorismesiti.gr/api/auth/profile` using the `cookie` -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 +### 1. Frontend **GET** profile data from Backend +```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 ``` {