GitHub Token Missing Required Scopes
When Claude Code attempts to access a GitHub repository, it receives 403 Forbidden errors despite having a valid GitHub token. The token was generated with limited scopes and lacks permissions needed for repository operations.
This manifests when the user's OAuth flow doesn't request all necessary scopes, or when GitHub's scope requirements change but the CLI isn't updated.
Error Messages You Might See
Common Causes
- OAuth scopes missing 'repo' or 'repo:read' permission during token generation
- Missing 'workflow' scope needed to read GitHub Actions
- OAuth flow hardcoded to minimal scopes instead of asking user for authorization
- Token generated with 'public_repo' only, but accessing private repository
- Admin repository access required but not requested during OAuth
How to Fix It
Request scopes: ['repo', 'user', 'gist', 'workflow', 'admin:repo_hook'] during OAuth flow. Display to user which scopes are being requested and why. Provide a 're-authorize' command to upgrade existing tokens. Store scope metadata with tokens to validate permissions before operations.
Real developers can help you.
You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.
Get HelpFrequently Asked Questions
What are the minimum GitHub scopes needed?
At minimum: repo (full repository access), user (user profile), and workflow (GitHub Actions). Add admin:repo_hook if managing webhooks.
Can scopes be changed without re-authenticating?
No. Users must re-authorize via the OAuth flow to grant additional scopes. Provide a clear CLI command to trigger re-authorization.
How should scope changes be handled in updates?
Detect when your scopes change. Prompt users to re-authorize on next CLI run, explaining what new permissions are needed and why.