Skip to content

feat: auto-persist rotated refresh tokens#8

Open
0x7551 wants to merge 1 commit intomotiful:mainfrom
0x7551:feat/refresh-token-persist
Open

feat: auto-persist rotated refresh tokens#8
0x7551 wants to merge 1 commit intomotiful:mainfrom
0x7551:feat/refresh-token-persist

Conversation

@0x7551
Copy link
Copy Markdown

@0x7551 0x7551 commented Apr 1, 2026

Summary

  • Automatically persist rotated OAuth refresh tokens back to config.yaml
  • Ensures gateway survives restarts without manual token updates
  • Handles both initial token exchange and scheduled auto-refresh rotation

Changes

  • src/oauth.ts: add persistRefreshToken() helper, detect token rotation in initOAuth and scheduleRefresh, write new token back to config file

Test plan

  • Start gateway — verify initial token refresh works as before
  • Simulate token rotation (provider returns new refresh_token) — verify config.yaml is updated
  • Verify config file write failure is logged as warning, not fatal

🤖 Generated with Claude Code

When the OAuth provider returns a new refresh token during token refresh,
automatically write it back to config.yaml so the gateway survives restarts
without manual token updates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@SakuraPuare
Copy link
Copy Markdown

真得要 每次失败了token就无了

@whiletrue0x
Copy link
Copy Markdown
Collaborator

nice,我白天看下。今天发了0.2更新

应该覆盖这个问题了,我double check下

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.

3 participants