Skip to content

chore: commit bun lock#6

Merged
felipefreitag merged 1 commit into
mainfrom
chore/commit-bun-lock
Mar 10, 2026
Merged

chore: commit bun lock#6
felipefreitag merged 1 commit into
mainfrom
chore/commit-bun-lock

Conversation

@zenorocha

Copy link
Copy Markdown
Member

No description provided.

@felipefreitag felipefreitag merged commit 8e152ee into main Mar 10, 2026
1 check failed
@felipefreitag felipefreitag deleted the chore/commit-bun-lock branch March 16, 2026 19:43
dielduarte added a commit that referenced this pull request Jun 25, 2026
Felipe review (#6): both refreshOAuthGrant and exchangeAuthorizationCode cast
the JSON body with `as` after only checking response.ok. A 200 with an
unexpected body (proxy error page, partial payload) would be persisted as a
grant. Add parseTokenResponse() to validate the required fields and reuse it in
both token calls.
dielduarte added a commit that referenced this pull request Jun 25, 2026
My earlier #6 validation required refresh_token_expires_in and broke login: the
/oauth/token response does not contain it. Confirmed against the server source
(apps/public-api): token.ts returns { access_token, token_type, expires_in,
refresh_token, scope } for both authorization_code and refresh_token grants
(token.ts:199-205, 384-388); the refresh-token expiry is stored server-side only
(issue-tokens.ts:101-103) and never sent to the client.

This is standard OAuth 2.0 — refresh timing is driven by the access-token expiry
(JWT exp), and an expired/revoked refresh token is signalled by an invalid_grant
error on refresh (token.ts:242-247), not by a client-known timestamp.

Changes:
- parseTokenResponse: validate access_token, refresh_token, scope (the fields the
  server actually returns); drop the refresh_token_expires_in requirement.
- Remove refresh_token_expires_at from the grant model entirely (OAuthGrantData,
  storeOAuthGrant, login). The CLI's old 'now + refresh_token_expires_in' computed
  NaN -> persisted null; that phantom field is gone.
- refreshOAuthGrant: no client-side expiry pre-check (unknowable); attempt refresh
  and surface re-login on a non-OK response.
- Tests updated to the real response shape; doctor refresh-failure test now mocks a
  400 invalid_grant instead of the removed pre-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