fix(auth): emit SIGNED_IN when set_session keeps a valid token by hsusul · Pull Request #1749 · supabase/supabase-py · GitHub
Skip to content

fix(auth): emit SIGNED_IN when set_session keeps a valid token - #1749

Merged
o-santi merged 1 commit into
supabase:mainfrom
hsusul:fix/auth-set-session-signed-in
Oct 22, 2026
Merged

o-santi merged 1 commit into
supabase:mainfrom
hsusul:fix/auth-set-session-signed-in

Conversation

@hsusul

@hsusul hsusul commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1748. set_session() notified listeners with TOKEN_REFRESHED even when the access token was still valid. auth-js setSession emits SIGNED_IN in that case and TOKEN_REFRESHED only after refreshing an expired token. Sync and async clients now do the same. An expired token still notifies TOKEN_REFRESHED.

Test plan

  • Added sync and async tests with a mock transport. On unchanged upstream, a token expiring in an hour notified TOKEN_REFRESHED and the new assertion failed. The expired-token case already passed.
  • After the change, those tests plus tests/test_helpers.py and tests/test_errors.py passed: 33 tests.
  • ruff check, ruff format --check, and mypy on src/supabase_auth and tests passed. git diff --check was clean.
  • make auth.tests was not run. It starts the auth Docker Compose stack. The existing test_set_session_* cases in test_gotrue.py sign up against that stack.

cc @olirice @silentworks

set_session notified TOKEN_REFRESHED even when the access token had
not expired, so restoring a session looked like a refresh.
@hsusul
hsusul requested a review from o-santi as a code owner October 15, 2026 04:30
@o-santi
o-santi merged commit 9c092db into supabase:main Oct 22, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set_session() emits TOKEN_REFRESHED for a token that is still valid

2 participants