mirror of
https://github.com/NikkeTryHard/zerogravity.git
synced 2026-04-25 15:15:59 +03:00
[GH-ISSUE #20] [Feature] Add automatic OAuth token refresh support for runtime /v1/token flow #16
Labels
No labels
bug
enhancement
enhancement
notice
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/zerogravity#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DarKWinGTM on GitHub (Feb 19, 2026).
Original GitHub issue: https://github.com/NikkeTryHard/zerogravity/issues/20
Summary
Please add first-class auto refresh token support when users provide token at runtime via
/v1/token(or env/file startup modes), so long-running sessions do not break when access token expires.Background
Current behavior (documented) indicates:
ya29...access token expires quicklyIn practical usage this causes interruptions and manual ops overhead for long-running proxy sessions.
Problem
When only access token is configured at runtime:
/v1/tokenagainThis is fragile for automation and daemon use.
Requested capability
Implement an automatic refresh strategy for runtime token mode.
Desired behavior
Suggested API/UX additions
POST /v1/tokenaccepts structured payload (optional extension):access_tokenrefresh_token(optional)expires_at/expires_in(optional)GET /v1/token/status(or include in/v1/health//v1/quota) to report:Acceptance criteria
/v1/tokenupdateWhy this matters
@NikkeTryHard commented on GitHub (Feb 19, 2026):
hey, thanks for the detailed writeup. we've been looking into this.
so the thing is — when Antigravity is installed locally, the proxy already reads the full OAuth Topic proto (access_token + refresh_token + expiry) from state.vscdb and injects it into the LS. the LS has Google's own refresh logic built-in so tokens stay alive forever. oauth2.googleapis.com is explicitly passthrough'd in the MITM layer so refresh traffic is never touched.
the real gap is exactly what you described: bare
ya29.xxxtokens via env/file//v1/tokenin docker/remote setups where there's no state.vscdb. those die after ~60min.we're not going to have the proxy hit oauth2 directly though — that's a fingerprint risk (the real webview never refreshes from an arbitrary IP like that). instead we're exploring injecting the refresh_token into the LS's internal state through the stub extension server so the LS does its own refresh natively. that way the refresh traffic looks byte-identical to the real app.
do you have any insights on how Google's OAuth flow works from the LS side? specifically how the extension server feeds the refresh_token to the LS's internal OAuth state machine? if you've poked at the LS binary at all that would be super helpful for this.
in the meantime, a workaround that already works today:
Backend::oauth_token()re-reads the token file on every request, so if you have a cron or systemd timer writing fresh tokens to~/.config/zerogravity/token, it'll pick them up automatically without any code changes.@DarKWinGTM commented on GitHub (Feb 20, 2026):
in the meantime, a workaround that already works today: Backend::oauth_token() re-reads the token file on every request, so if you have a cron or systemd timer writing fresh tokens to ~/.config/zerogravity/token, it'll pick them up automatically without any code changes.
Agree this that is safe way to prevent to inject any action Antigravity do with token and refresh.