Use this guide to understand the security differences between legacy classic personal access tokens (PATs) and the modern fine‑grained PATs. Follow the recommendations here to reduce blast radius, improve auditability, and meet organization security policies.
Never publish or share real personal access tokens. The examples shown below are illustrative.

What is a Classic Personal Access Token?
A classic PAT is effectively a master key that grants whatever access the associated user account has. It is simple and powerful — but risky if compromised.
- Classic PATs are user‑scoped — a token granted the
reposcope has access to every repository the user can access. - You cannot limit a classic PAT to a single repository or resource.
- Classic PATs can be configured with no expiration; if compromised, the blast radius can be indefinite.
- Actions performed with a compromised classic PAT appear in audit logs as the user’s own actions, complicating attribution and forensics.


What is a Fine‑Grained Personal Access Token?
A fine‑grained PAT acts like a programmed key card: it is scoped to specific repositories and actions. When creating a fine‑grained PAT, the user must explicitly select repositories and set precise permissions for each resource. Fine‑grained PATs require an expiration date and can be subject to admin approval for organization access.

- Fine‑grained PATs limit tokens to explicit repositories and actions (for example: read issues, write pull requests).
- Expiration is mandatory, which reduces indefinite exposure.
- Owners can enforce admin approval before a token can access organization resources — preventing unseen tokens from gaining organization‑level access.
Example: Using a PAT to Call the GitHub API
A simple curl request shows how a token is used to authenticate API calls. Replace the example token with a real, securely stored token when testing; never embed tokens in source code or public repositories.Comparison: Classic vs Fine‑Grained
Best Practices
- Prefer fine‑grained PATs for scripts, CI jobs, and integrations where you can specify exact repositories and permissions.
- Enforce short expirations and rotate tokens regularly.
- Require admin approval for tokens that access organization resources.
- Store tokens in secret managers or environment variables — never commit them to source control.
- Monitor audit logs for unusual activity and revoke tokens immediately if compromise is suspected.
Summary (Exam & Practical)
- Classic personal access tokens grant broad, user‑scoped access and may not expire. They are convenient but increase blast radius and complicate audits.
- Fine‑grained personal access tokens are repository‑scoped, support precise permissions, mandate expirations, and can require admin approval — all of which reduce risk and improve governance.
- When possible, adopt fine‑grained PATs and administrative controls to reduce blast radius and improve auditability.
Links and References
- GitHub Docs: Fine‑grained personal access tokens
- GitHub Docs: Personal access tokens (classic)
- GitHub Audit Log