From aed0e2f7f4c97cf412f7f5bf8044c3715be76477 Mon Sep 17 00:00:00 2001 From: Josh XT Date: Wed, 12 Jun 2024 23:10:04 -0400 Subject: [PATCH] set cookie then redirect --- components/Auth.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/Auth.py b/components/Auth.py index c037cf49..6bcc9bc3 100644 --- a/components/Auth.py +++ b/components/Auth.py @@ -48,6 +48,7 @@ def google_sso_button(): f'', unsafe_allow_html=True, ) + st.stop() if "code" in st.query_params: if st.query_params["code"] != "": if isinstance(st.query_params["code"], list): @@ -65,9 +66,15 @@ def google_sso_button(): if "detail" in res: details = str(res["detail"]) if details.startswith("http"): - token = details.split("?token=")[1] + token = details.split("token=")[1] set_cookie("token", token, 1, "google_sso_token") - st.rerun() + # Redirect to the login link + st.markdown( + f'', + unsafe_allow_html=True, + ) + time.sleep(0.5) + st.stop() else: st.error(details) logging.error(f"Error with Google SSO: {details}")