Ask for repo at GitHub sign-in so the Plans tab stops asking to connect GitHub
Merged
CH
16d ago+208+208+012345678901234567890123456789-32-32-01234567890123456789
Summary
- Why: a developer who signed in with GitHub had to authorize GitHub a second time on the Plans tab. Sign-in asked for
read:useranduser:email, and planning needsrepo. - Scopes:
GITHUB_SIGN_IN_SCOPESinauth-policy.tsis nowread:user,user:email,repo, andauth.tsuses it. - Token refresh:
updateAccountOnSignInis nowtrue, so a GitHub sign-in replaces the stored token. It wasfalseonly so a narrow sign-in token could not overwrite the linked one. Sign-in and Connect GitHub now ask for the same scopes. An existing GitHub account getsrepoon its next GitHub sign-in. - Still connects once: Google sign-ins, and existing GitHub accounts that have not signed in again yet. A user who refuses
repoon GitHub's consent screen getsaccess-denied, and the Plans tab offers Connect GitHub, as before. - Trade-off: every GitHub sign-in now asks for full read and write access to the user's repos, including users who never plan. GitHub's best-practices page asks for minimal scopes and recommends GitHub Apps. We chose this as the simplest fix.
PRIVACY.md: "Your account" now says GitHub sign-in grantsrepo, what that covers, what Luke reads with it, and how to revoke it. "Last updated" is now 4 October 2026.docs/PLANNING.mdand the code comments are updated to match.
Evidence
./scripts/check.shexit 0.- New test
apps/web/tests/auth-github-sign-in.test.tsruns a real Better Auth GitHub sign-in against a fake GitHub:- sign-in asks for
repo, and the token it stores reads repositories; - a second sign-in replaces a profile-only token with one that has
repo.
Both fail with the old scopes andupdateAccountOnSignIn: false.
- sign-in asks for
- Removed the constant check
updateAccountOnSignIn === falsefromauth-database.test.ts. The new behavior test covers that setting. - No desktop or UI code changed. Not exercised against live GitHub.
š¤ Generated with Claude Code