Hey:)
So I have been trying for the past few weeks to implement login with google to my streamlit app (a request from my company) AND IT HAS BEEN TERRIBLE.
I am now trying to implement the new feature of guest login from the Streamlit-authenticator component bc it includes the option to login with google (super cool I wish it worked).
The feature does show the button , it does redirect to the google login page and it does goes back to the right url for me but the issue is that it does not login (so the session state does not have the email and such). No error or anything , just goes back and still nothing.
This is what I tried :
Loading config file
with open(‘configuration/config.yaml’, ‘r’, encoding=‘utf-8’) as file:
config = yaml.load(file, Loader=SafeLoader)
Creating the authenticator object
authenticator = stauth.Authenticate(
config[‘credentials’],
config[‘cookie’][‘name’],
config[‘cookie’][‘key’],
config[‘cookie’][‘expiry_days’]
)
Creating a login widget
try:
authenticator.login()
except LoginError as e:
st.error(e)
Creating a guest login button
try:
authenticator.experimental_guest_login(‘Login with Google’, provider=‘google’,
oauth2=config[‘oauth2’])
except LoginError as e:
st.error(e)
Authenticating user
if st.session_state[‘authentication_status’]:
authenticator.logout()
st.write(f’Welcome {st.session_state[“name”]}')
st.title(‘Some content’)
elif st.session_state[‘authentication_status’] is False:
st.error(‘Username/password is incorrect’)
elif st.session_state[‘authentication_status’] is None:
st.warning(‘Please enter your username and password’)
Saving config file
with open(‘configuration/config.yaml’, ‘w’, encoding=‘utf-8’) as file:
yaml.dump(config, file, default_flow_style=False)
I have set the config.yaml exactly the same as in the example they give in the git repo of the component .
What am I doing wrong?