From f89b52cc5694ec71655830cf1f0c3c0d9d8229d0 Mon Sep 17 00:00:00 2001 From: Ste Vaidis Date: Tue, 7 Jan 2025 15:40:06 +0200 Subject: [PATCH] Update OAuth2-Backend-Approach.md --- OAuth2-Backend-Approach.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/OAuth2-Backend-Approach.md b/OAuth2-Backend-Approach.md index fea8011..a2f5122 100644 --- a/OAuth2-Backend-Approach.md +++ b/OAuth2-Backend-Approach.md @@ -84,9 +84,9 @@ Content-Type: application/x-www-form-urlencoded grant_type=authorization_code& code=AAAABCX4XfWgyVyziyLg0QHHHHH& -redirect_uri=https://xorismesiti.gr/callback& client_id=ABC34JHS9D& -client_secret=PASS1234 +client_secret=PASS1234& +redirect_uri=https://xorismesiti.gr/callback ``` ### 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 { @@ -113,7 +113,18 @@ client_secret=PASS1234 ```
-

Backend code

+ +

Backend code

+

+

Implements the endpoint /auth/google/callback

+
+
    +
  • Recieves authorization code from Google
  • +
  • POST send : authorization code to https://oauth2.googleapis.com/token
  • +
  • POST reqponse: access & refresh tokens
  • +
  • Respond the Fronend initial request with a cookie
  • +
+
```js // Backend callback URL: http://localhost:3000/auth/google/callback