From 17fad574ffd80a7cb3d927a074804de9ef12a399 Mon Sep 17 00:00:00 2001 From: Ste Vaidis Date: Tue, 7 Jan 2025 15:47:57 +0200 Subject: [PATCH] Update OAuth2-Backend-Approach.md --- OAuth2-Backend-Approach.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/OAuth2-Backend-Approach.md b/OAuth2-Backend-Approach.md index 23a7ad7..f342b00 100644 --- a/OAuth2-Backend-Approach.md +++ b/OAuth2-Backend-Approach.md @@ -114,19 +114,20 @@ redirect_uri=https://xorismesiti.gr/callback
+

Backend code



-

Implements the endpoint /auth/google/callback

-
-
    -
  • Recieves authorization code from Google
  • -
  • POST send the authorization code to https://oauth2.googleapis.com/token
  • -
  • POST response the access & refresh tokens
  • -
  • Respond the Fronend initial request with a cookie
  • -
+ Implements the endpoint /auth/google/callback

+

1. Recieves authorization code from Google


+

2. POST send the authorization code to https://oauth2.googleapis.com/token


+

3. POST response the access & refresh tokens


+

4. Respond the Fronend initial request with a cookie contains the access token


+
+

+ ```js // Backend callback URL: http://localhost:3000/auth/google/callback app.get('/auth/google/callback', async (req, res) => {