Spaces:
Sleeping
Sleeping
Commit ·
62e957f
1
Parent(s): 6c653a2
Document the required /oauth2callback redirect_uri path
Browse filesLogin appeared to succeed (no error) but st.user.is_logged_in never
became True. Root cause: Streamlit only processes the OAuth code
exchange at the hardcoded /oauth2callback route, but redirect_uri was
set to the bare app URL, matching what was already registered in
Google Cloud Console. Google therefore redirected back to the plain
home page, whose normal route silently ignores the leftover code/state
query params, so the auth cookie never gets set. Fixed local
secrets.toml and documented that both the Google Cloud OAuth client's
authorized redirect URIs and AUTH_REDIRECT_URI need the /oauth2callback
suffix. Verified by inspecting the real /auth/login redirect Location
header end-to-end.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
README.md
CHANGED
|
@@ -40,7 +40,12 @@ click through.
|
|
| 40 |
|
| 41 |
### One-time Google Cloud setup
|
| 42 |
1. Create an OAuth 2.0 **Web application** Client ID; add your app's URL(s)
|
| 43 |
-
as authorized redirect URIs (e.g.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
2. On the OAuth consent screen, add every player's Google account email
|
| 45 |
under **Test users** (keep publishing status as "Testing" -- this avoids
|
| 46 |
Google's verification review entirely for `drive.file`, a scope that
|
|
@@ -51,7 +56,7 @@ click through.
|
|
| 51 |
### Local dev — `.streamlit/secrets.toml` (gitignored, never commit this)
|
| 52 |
```toml
|
| 53 |
[auth]
|
| 54 |
-
redirect_uri = "http://localhost:8501"
|
| 55 |
cookie_secret = "<random string>"
|
| 56 |
client_id = "<oauth client id>"
|
| 57 |
client_secret = "<oauth client secret>"
|
|
@@ -68,4 +73,5 @@ prompt = "consent select_account"
|
|
| 68 |
`.streamlit/secrets.toml` at startup from individual Space secrets (Settings →
|
| 69 |
Variables and secrets), so nothing sensitive needs to live in the repo or the
|
| 70 |
image: `AUTH_CLIENT_ID`, `AUTH_CLIENT_SECRET`, `AUTH_COOKIE_SECRET`,
|
| 71 |
-
`AUTH_REDIRECT_URI` (your Space's public URL
|
|
|
|
|
|
| 40 |
|
| 41 |
### One-time Google Cloud setup
|
| 42 |
1. Create an OAuth 2.0 **Web application** Client ID; add your app's URL(s)
|
| 43 |
+
**with the `/oauth2callback` path** as authorized redirect URIs (e.g.
|
| 44 |
+
`http://localhost:8501/oauth2callback` for local dev, and
|
| 45 |
+
`https://<your-space>.hf.space/oauth2callback` for a deployed Space).
|
| 46 |
+
Streamlit only processes the OAuth code exchange at that exact path --
|
| 47 |
+
a bare app URL without `/oauth2callback` will silently fail to complete
|
| 48 |
+
login (no error, but `st.user.is_logged_in` never becomes `True`).
|
| 49 |
2. On the OAuth consent screen, add every player's Google account email
|
| 50 |
under **Test users** (keep publishing status as "Testing" -- this avoids
|
| 51 |
Google's verification review entirely for `drive.file`, a scope that
|
|
|
|
| 56 |
### Local dev — `.streamlit/secrets.toml` (gitignored, never commit this)
|
| 57 |
```toml
|
| 58 |
[auth]
|
| 59 |
+
redirect_uri = "http://localhost:8501/oauth2callback"
|
| 60 |
cookie_secret = "<random string>"
|
| 61 |
client_id = "<oauth client id>"
|
| 62 |
client_secret = "<oauth client secret>"
|
|
|
|
| 73 |
`.streamlit/secrets.toml` at startup from individual Space secrets (Settings →
|
| 74 |
Variables and secrets), so nothing sensitive needs to live in the repo or the
|
| 75 |
image: `AUTH_CLIENT_ID`, `AUTH_CLIENT_SECRET`, `AUTH_COOKIE_SECRET`,
|
| 76 |
+
`AUTH_REDIRECT_URI` (your Space's public URL **with `/oauth2callback`
|
| 77 |
+
appended**, e.g. `https://randomcatlover-boardgames-tracker.hf.space/oauth2callback`).
|