-
Notifications
You must be signed in to change notification settings - Fork 4.2k
st.login() when using Google - state parsing appears to be incorrect #10356
Copy link
Copy link
Closed
Labels
feature:authenticationRelated to user authenticationRelated to user authenticationpriority:P3Medium priorityMedium prioritystatus:confirmedBug has been confirmed by the Streamlit teamBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedSomething isn't working as expected
Description
Checklist
- I have searched the existing issues for similar issues.
- I added a very descriptive title to this issue.
- I have provided sufficient information below to help reproduce this issue.
Summary
When attempting to configure st.login() with our application, we are getting an error that indicates that the state might not be properly set according to the code that attempts to parse it.
We have confirmed that the received state is the same as the outgoing state, but upon redirect it looks like it doesn't parse as expected.
Reproducible Code Example
# streamlit.py
import streamlit as st
if st.button("Log in with Google"):
st.login(provider='google_dev')
# secrets.toml
[auth]
redirect_uri = "http://localhost:8501/oauth2callback"
cookie_secret = "somesecret"
[auth.google_dev]
client_id = "something-something.apps.googleusercontent.com"
client_secret = "some-secret"
server_metadata_url = "https://accounts.google.com/.well-known/openid-configuration"Steps To Reproduce
- Click on the button
- Select your profile
- Check server logs
Expected Behavior
I would have expected what looked to be an incredibly easy way to replace our current homegrown implementation of OAuth in Streamlit! Really pumped for this, just hitting a minor snag that I think looks like a bug.
Current Behavior
Traceback (most recent call last):
...
venv/lib/python3.11/site-packages/streamlit/web/server/oauth_authlib_routes.py", line 128, in get
provider = self._get_provider_by_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../.venv/lib/python3.11/site-packages/streamlit/web/server/oauth_authlib_routes.py", line 157, in _get_provider_by_state
_, _, recorded_provider, code = key.split("_")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 4)
Is this a regression?
- Yes, this used to work in a previous version.
Debug info
- Streamlit version: 1.42.0
- Authlib version: 1.4.1
- Python version: 3.11
- Operating System: MacOS 15.2 (24C101)
- Browser: Version 132.0.6834.160 (Official Build) (arm64)
Additional Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature:authenticationRelated to user authenticationRelated to user authenticationpriority:P3Medium priorityMedium prioritystatus:confirmedBug has been confirmed by the Streamlit teamBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedSomething isn't working as expected