Skip to content

fix(auth): persist updated refresh_token and refresh_expires_at on token refresh - #42

Merged
bwebs merged 2 commits into
mainfrom
bryan/auth-token
Jul 23, 2026
Merged

fix(auth): persist updated refresh_token and refresh_expires_at on token refresh#42
bwebs merged 2 commits into
mainfrom
bryan/auth-token

Conversation

@bwebs

@bwebs bwebs commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes an issue where renewing or refreshing tokens did not update or save refresh_token and refresh_expires_at in the database.

Changes

  • In CurrentAuth.set_token() (lkr/auth_service.py), updated the SQL UPDATE auth statement to persist refresh_token and refresh_expires_at alongside access_token and token_type.
  • Updated in-memory properties on CurrentAuth when a new refresh_token is present.
  • Added tests in tests/test_oauth_account.py verifying that refresh_token is updated in SQLite after token refresh.

Fixes #41

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the token storage logic in auth_service.py to persist the refresh_token and its expiration timestamp in the database, with corresponding updates to the test suite. The review feedback points out that refresh_expires_at should only be updated when a new refresh_token is actually returned, to avoid mismatching the server's actual token validity when the refresh token is not rotated.

Comment thread lkr/auth_service.py Outdated
@bwebs
bwebs merged commit 190261e into main Jul 23, 2026
1 check passed
@bwebs
bwebs deleted the bryan/auth-token branch July 23, 2026 21:19
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.

OAuth refresh token and refresh_expires_at not persisted during token refresh

1 participant