Skip to content

fix: preserve refresh token when token endpoint omits it (→ 0.6.1) - #16

Merged
neilgfoster merged 1 commit into
mainfrom
009-fix-refresh-token-survival
Jun 27, 2026
Merged

fix: preserve refresh token when token endpoint omits it (→ 0.6.1)#16
neilgfoster merged 1 commit into
mainfrom
009-fix-refresh-token-survival

Conversation

@neilgfoster

Copy link
Copy Markdown
Owner

Summary

  • Per RFC 6749 §6, a token-endpoint response MAY omit refresh_token (meaning "keep the previous one"). _store_token_response was overwriting it with "", so the second token expiry always raised "no refresh token — run auth-login again" and forced a full re-authentication.
  • _store_token_response now accepts an optional prev_tok kwarg and falls back to the old refresh token when the response omits one.
  • _refresh_if_needed passes prev_tok=tok so the fallback is available.
  • Regression test added: SilentRefreshTest::test_refresh_token_preserved_when_response_omits_it.

Test plan

  • uv run pytest tests/ -k SilentRefresh -v — both silent-refresh tests pass
  • uv run pytest tests/ -v — all 88 tests green

🤖 Generated with Claude Code

Per RFC 6749 §6, a token-endpoint response MAY omit refresh_token
(meaning "keep the old one"). _store_token_response was storing "" in
that case, causing the next expiry to raise "no refresh token" and
force a full re-auth. The previous refresh token is now preserved when
the response does not supply a new one.

Adds a regression test covering the omitted-refresh_token path.

Bumps to 0.6.1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@neilgfoster
neilgfoster merged commit b57d25b into main Jun 27, 2026
1 check passed
@neilgfoster
neilgfoster deleted the 009-fix-refresh-token-survival branch June 27, 2026 07:37
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.

1 participant