25 lines
701 B
Python
25 lines
701 B
Python
|
|
import streamlit as st
|
|
import security
|
|
|
|
@st.cache_data
|
|
def setup_page(REDIRECT_URI):
|
|
# st.set_page_config(
|
|
# page_title=page_title,
|
|
# page_icon="👋",
|
|
# )
|
|
|
|
if st.query_params.get('code'):
|
|
security.handle_redirect(REDIRECT_URI)
|
|
|
|
access_token = st.session_state.get('access_token')
|
|
|
|
if access_token:
|
|
user_info = security.get_user_info(access_token)
|
|
st.session_state['user_info'] = user_info
|
|
return True
|
|
else:
|
|
st.write("Please sign-in to use this app.")
|
|
auth_url = security.get_auth_url(REDIRECT_URI)
|
|
st.markdown(f"<a href='{auth_url}' target='_self'>Sign In</a>", unsafe_allow_html=True)
|
|
st.stop() |