From d80f3699cd6da32193ba665fb93efb7a2c054338 Mon Sep 17 00:00:00 2001 From: Pratham Soni Date: Mon, 24 Jun 2024 10:52:12 -0500 Subject: [PATCH] revert SSO changes --- streamlit/security.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/streamlit/security.py b/streamlit/security.py index 2433203..d7465d2 100644 --- a/streamlit/security.py +++ b/streamlit/security.py @@ -2,7 +2,6 @@ import streamlit as st import msal import requests import boto3 -import secrets from botocore.exceptions import ClientError import json @@ -58,11 +57,7 @@ app = msal.ConfidentialClientApplication(CLIENT_ID, authority=AUTHORITY, client_ def get_auth_url(REDIRECT_URI): - #Generates a random stat parameter - state = secrets.token_urlsafe(16) - #Stores the state param in the session state - st.session_state['state'] = state - auth_url = app.get_authorization_request_url(SCOPE, redirect_uri=REDIRECT_URI, state=state) + auth_url = app.get_authorization_request_url(SCOPE, redirect_uri=REDIRECT_URI ) return auth_url @st.cache_data @@ -80,13 +75,11 @@ def get_user_info(access_token): def handle_redirect(REDIRECT_URI): if not st.session_state.get('access_token'): - query_params = st.experimental_get_query_params() code = st.query_params.get('code') - state=query_params.get('state') - if code and state and state[0] == st.session_state.get('state'): - access_token = get_token_from_code(code[0], REDIRECT_URI) + if code: + access_token = get_token_from_code(code, REDIRECT_URI) st.session_state['access_token'] = access_token - clear_url() + st.session_state