Repository navigation
feat: renew browser sessions with refresh tokens - #74
Draft
AntTheLimey wants to merge 5 commits into
Draft
AntTheLimey wants to merge 5 commits into
AntTheLimey wants to merge 5 commits into
Conversation
AntTheLimey
force-pushed
the
feat/browser-login-refresh
branch
from
October 19, 2026 22:09
eebf054 to
1b10de8
Compare
AntTheLimey
force-pushed
the
feat/browser-login
branch
from
October 19, 2026 22:59
4029529 to
e69baf0
Compare
Login asks for offline_access and keeps Auth0's refresh token in the OS keychain. A session near expiry renews itself, saving the new access token and the rotated refresh token before use. invalid_grant clears the refresh token and ends the session; logout revokes it. Without a refresh token or a keychain, step-1 behaviour is unchanged.
A per-profile lock file beside the token cache serialises renewal, and the cache is re-read under it, so concurrent commands send the rotating refresh token once. invalid_grant deletes the keychain entry only if it still holds the token sent. The rotated refresh token is saved before the access token; a transient renewal failure keeps using a still-valid token. Discarded refresh tokens are revoked at login, and doctor says why it skipped the Tenant row.
Cover the per-profile session lock and stale-lock recovery, the refresh token keychain entry kept apart from the client secret, the Auth0 refresh and revoke calls, and a refused or unreachable renewal ending in exit 5.
AntTheLimey
force-pushed
the
feat/browser-login-refresh
branch
from
October 19, 2026 23:01
1b10de8 to
9385f9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Step 2 of browser sign-in, stacked on #73. It removes the forced re-login when the access token expires.
offline_accessand keeps Auth0's refresh token in the OS keychain, under its own entry, never in the config file or token cache. With no refresh token (until saas#2043 is applied) or no keychain, login behaves exactly as in feat: browser sign-in for pgedge starfleet #73.--wait. The rotated refresh token is saved before the new access token is cached and used. A per-profile lock file serialises renewal across processes. Under the lock, the cache is re-read so a second process uses the first one's renewal instead of reusing a rotated token, which Auth0 would treat as theft and revoke. saas#2043 also adds a 10s reuse leeway.invalid_grant) clears the refresh token, but only if it's still the one sent, and gives the existing exit-5 "sign in again" message. A network or 5xx failure keeps the token and falls back to the current access token while it's valid.auth statusanddoctorreport whether a session renews. An expired access token with a refresh token is "renews on next use", exit 0.--debugmasks the refresh token, the token responses and the revoketokenfield.Checks
make testpasses. Coverage is 90.0% against the 90.0% threshold.make lint,make docs-checkandmake lint-docsare clean.invalid_grantRisks
make test.