Can I check the permissions of a token

Is it possible to get a list of the permissions of a given token?
Or check if a token has a certain set of permissions?

In one of my actions I would like to warn that the provided token is lacking a specific permission. The errors currently issued by just trying to do something and failing are not always easy to understand. If I could check the permission before failing I could issue a helpful warning like the provided token is missing the xxx permission.

1 Like

@tombrus,

We seem have no available methods to list all the access scopes of a token.
I tried using the OAuth Authorizations API, but did not work.

If you are the authenticated user of the token, you can try to navigate to Personal settings > Developer settings > Personal access tokens to view the access scopes of the tokens you have created.

1 Like

Hi @brightran!

interactively going to the token def will work, but it does not help in a script (unless you do some serious curl hacking I guess ;-)).

So this seems like a request for a valuable extension to the API, right?
Can I file it somewhere?

@tombrus,

You can share a feature request in the Feedback form for GitHub.
That will allow you to directly interact with the appropriate engineering team, and make it more convenient for the engineering team to collect and categorize your suggestions.

Thanks @brightran, I entered a feature request.