From e0261299e676acd38561aaf437fd9e1c55d5013d Mon Sep 17 00:00:00 2001 From: feijooso Date: Mon, 25 Mar 2024 21:38:00 -0300 Subject: [PATCH 1/4] google redirect uri --- .env.dist | 3 ++- app/service/Users.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.env.dist b/.env.dist index dd2d5cc..2736864 100644 --- a/.env.dist +++ b/.env.dist @@ -12,4 +12,5 @@ POSTGRES_SCHEMA= # Google GOOGLE_CLIENT_ID= -GOOGLE_CLIENT_SECRET= \ No newline at end of file +GOOGLE_CLIENT_SECRET= +GOOGLE_REDIRECT_URI= \ No newline at end of file diff --git a/app/service/Users.py b/app/service/Users.py index 5f78cc9..1d7b7cf 100644 --- a/app/service/Users.py +++ b/app/service/Users.py @@ -42,7 +42,7 @@ def _get_access_token(self, authorization_code): "client_secret": os.environ["GOOGLE_CLIENT_SECRET"], "code": authorization_code, "grant_type": "authorization_code", - "redirect_uri": "http://localhost:8000/auth/google/callback" + "redirect_uri": os.environ["GOOGLE_REDIRECT_URI"] } response = requests.post(token_url, data=payload) if response.status_code == 200: From 6c7f485f88b84409cd1a4dcf8256fb7f3339ca8d Mon Sep 17 00:00:00 2001 From: feijooso Date: Mon, 25 Mar 2024 22:13:33 -0300 Subject: [PATCH 2/4] prints --- app/service/Users.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/service/Users.py b/app/service/Users.py index 1d7b7cf..b02e485 100644 --- a/app/service/Users.py +++ b/app/service/Users.py @@ -44,7 +44,9 @@ def _get_access_token(self, authorization_code): "grant_type": "authorization_code", "redirect_uri": os.environ["GOOGLE_REDIRECT_URI"] } + print(payload) response = requests.post(token_url, data=payload) + print(response) if response.status_code == 200: return response.json().get("access_token") else: From 4bd1ac5569db5435cfb0b1200bed4db949082236 Mon Sep 17 00:00:00 2001 From: feijooso Date: Mon, 25 Mar 2024 22:20:47 -0300 Subject: [PATCH 3/4] print response --- app/service/Users.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/service/Users.py b/app/service/Users.py index b02e485..f52e214 100644 --- a/app/service/Users.py +++ b/app/service/Users.py @@ -46,7 +46,7 @@ def _get_access_token(self, authorization_code): } print(payload) response = requests.post(token_url, data=payload) - print(response) + print(response.text) if response.status_code == 200: return response.json().get("access_token") else: From 6f78ae48ae0e282938460054855d65382766abcf Mon Sep 17 00:00:00 2001 From: feijooso Date: Mon, 25 Mar 2024 22:34:19 -0300 Subject: [PATCH 4/4] remove prints :) --- app/service/Users.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/service/Users.py b/app/service/Users.py index f52e214..1d7b7cf 100644 --- a/app/service/Users.py +++ b/app/service/Users.py @@ -44,9 +44,7 @@ def _get_access_token(self, authorization_code): "grant_type": "authorization_code", "redirect_uri": os.environ["GOOGLE_REDIRECT_URI"] } - print(payload) response = requests.post(token_url, data=payload) - print(response.text) if response.status_code == 200: return response.json().get("access_token") else: