Files
assembly/quartz/components/scripts
Corey PettyandClaude Opus 4.8 9bd5ceba1b Use a GitHub App so commenters aren't asked for public_repo
An OAuth App can only request coarse scopes; the narrowest one permitting
comments on a public repo's Discussions is `public_repo`, which grants
write access to every public repository the commenter owns. That is an
unreasonable ask for a reader who wants to leave one inline note.

A GitHub App's permissions are fixed by the App definition, so a commenter
grants exactly `Discussions: write` on logos-co/assembly and nothing else.

Worker:
- drop `scope` from the authorize URL; App permissions replace it
- pass expires_in / refresh_token through the callback postMessage
- add POST /api/auth/refresh to trade a refresh token for a fresh user
  token, and allow POST in the CORS methods

Client:
- store a session object (token, expiresAt, refreshToken, refreshExpiresAt)
  rather than a bare string, parsing a legacy bare token defensively so
  existing sign-ins are not broken
- refresh silently in ensureToken() with a 60s skew before expiry, falling
  back to the sign-in popup; keep login() free of any preceding await so
  the popup is not blocked
- treat an expired-but-refreshable session as signed in, so the composer
  does not flash signed-out every 8 hours

GitHub Apps are governed by installation rather than the org's OAuth App
access restrictions, so the previous org-approval step is replaced by an
owner installing the App on the repo.

Both configurations work: if the App has token expiration disabled, GitHub
omits the expiry fields and the client treats the token as non-expiring.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 10:49:39 -04:00
..
2025-04-17 19:45:17 -07:00
2025-03-10 16:20:08 -07:00