From 5d1908d6bab1423f5c9625310f4f89aa60d669ad Mon Sep 17 00:00:00 2001 From: Angelique Ulep Date: Tue, 2 Apr 2024 02:29:51 -0400 Subject: [PATCH 1/2] Use latest query params from streamlit --- src/streamlit_auth/google_auth.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/streamlit_auth/google_auth.py b/src/streamlit_auth/google_auth.py index 706938c..f303ed9 100644 --- a/src/streamlit_auth/google_auth.py +++ b/src/streamlit_auth/google_auth.py @@ -80,8 +80,7 @@ async def get_access_token( def get_access_token_from_query_params( client: GoogleOAuth2, redirect_url: str ) -> OAuth2Token: - query_params = st.experimental_get_query_params() - code = query_params["code"][0] + code = st.query_params["code"] token = asyncio.run( get_access_token(client=client, redirect_url=redirect_url, code=code) ) @@ -102,7 +101,7 @@ def get_logged_in_user() -> Optional[Dict]: token_from_params = get_access_token_from_query_params(client, redirect_url) except KeyError: return None - + user_info = decode_user(token=token_from_params["id_token"]) return user_info \ No newline at end of file From 912115c38ef0097c3859773d30f70ed12c7a9749 Mon Sep 17 00:00:00 2001 From: Angelique Ulep Date: Tue, 2 Apr 2024 02:54:22 -0400 Subject: [PATCH 2/2] Update clearing of params --- src/streamlit_auth/google_auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/streamlit_auth/google_auth.py b/src/streamlit_auth/google_auth.py index f303ed9..0d88864 100644 --- a/src/streamlit_auth/google_auth.py +++ b/src/streamlit_auth/google_auth.py @@ -85,7 +85,7 @@ def get_access_token_from_query_params( get_access_token(client=client, redirect_url=redirect_url, code=code) ) # Clear query params - st.experimental_set_query_params() + st.query_params.clear() return token