From 6c1d90b0f57961905be29cef0c96ed0307f264f4 Mon Sep 17 00:00:00 2001 From: Ste Vaidis Date: Tue, 7 Jan 2025 15:08:12 +0200 Subject: [PATCH] Update OAuth2-Backend-Approach.md --- OAuth2-Backend-Approach.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OAuth2-Backend-Approach.md b/OAuth2-Backend-Approach.md index 7a4beaa..9653e5c 100644 --- a/OAuth2-Backend-Approach.md +++ b/OAuth2-Backend-Approach.md @@ -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 4. Back **response** to Front with profile data -

+


@@ -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.* +


@@ -100,7 +101,11 @@ client_secret=PASS1234 "scope": "email profile" } ``` -### 3. Back **response** to Front + +### 3. Backend **response** to Front + +
+

Backend code

```js // Backend callback URL: http://localhost:3000/auth/google/callback @@ -134,8 +139,9 @@ app.get('/auth/google/callback', async (req, res) => { }); ``` +
- +


@@ -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 ``` {