Skip to content

Commit

Permalink
fix endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Jun 12, 2024
1 parent c20af37 commit 41168a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion components/Auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pyotp
import qrcode
import requests
import logging
import streamlit as st
from streamlit_js_eval import get_cookie, set_cookie
from streamlit_oauth import OAuth2Component
Expand Down Expand Up @@ -39,7 +40,7 @@ def google_sso_button():
use_container_width=True,
pkce="S256",
)
print(result)
logging.info(result)
if result and "code" in result:
# Send google auth access_token and refresh_token to MagicalAuth
response = requests.post(
Expand Down
6 changes: 4 additions & 2 deletions sso/Google.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import base64
import json
import requests
import logging
from email.mime.text import MIMEText
from Globals import getenv

Expand Down Expand Up @@ -36,8 +37,8 @@ def get_google_access_token(code, redirect_uri=None):
.replace("%3D", "=")
)
response = requests.post(
"https://oauth2.googleapis.com/token",
data={
f"https://accounts.google.com/o/oauth2/token",
params={
"code": code,
"client_id": getenv("GOOGLE_CLIENT_ID"),
"client_secret": getenv("GOOGLE_CLIENT_SECRET"),
Expand All @@ -46,6 +47,7 @@ def get_google_access_token(code, redirect_uri=None):
},
)
if response.status_code != 200:
logging.error(f"Error getting Google access token: {response.text}")
return None, None
data = response.json()
access_token = data["access_token"]
Expand Down

0 comments on commit 41168a6

Please sign in to comment.