Skip to content

How do I determine which scopes are attached to a GitHub token? #643

Answered by zackproser
zackproser asked this question in How do I
Discussion options

You must be logged in to vote

You can use the following command to make a call to GitHub's API, supplying the GitHub personal access token (PAT) in question and requesting that curl only return the response headers:

curl -H "Authorization: Bearer $GH_TOKEN" https://api.github.com/user -Is | grep x-oauth-scopes

GitHub's API returns the scopes attached to a given token in the x-oauth-scopes response header, like so:

x-oauth-scopes: repo:invite, repo:status

The above response indicates the token set in $GH_TOKEN only had the repo:invite and repo:status permissions attached to it. If, instead ALL repo permissions had been attached, you'd find this header response from GitHub:

x-oauth-scopes: repo - which indicates that AL…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zackproser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant