Connect GitHub safely (token scopes and SSO)
Most GitHub integration problems come from over-scoped tokens or missing SSO authorization. This guide keeps access minimal and reliable.
1
Use fine-grained tokens
- Prefer fine-grained PATs over classic PATs.
- Set an expiration date.
- Select only the repositories your agent needs.
2
Grant only required permissions
Start with read permissions for repository contents, issues, and pull requests. Add write scopes only for explicit workflows.
3
Authorize org SSO
If your org enforces SAML SSO, explicitly authorize the token for that organization or all API calls will fail despite valid credentials.
4
Rotate and audit regularly
- Rotate tokens on a schedule.
- Revoke unused tokens immediately.
- Review integration access quarterly.