gh-token-scopes
v1.0.1
Published
get the list of scopes for a github access token
Downloads
6
Maintainers
Readme
gh-token-scopes
If your application relies on personal access tokens (whose permissions can be updated at any time) you may want to verify the scope range before making any API calls; this module helps you do just that.
** I don’t want to expose an access token, so CI is out of the question, but you can easily run the tests yourself. **
Install
$ npm install gh-token-scopes
Usage
var scopes = require('gh-token-scopes')
var contains = require('gh-token-scopes/contains')
var token = '{some-personal-access-token}'
scopes(token, function (err, list) {
console.log(list)
> ['public_repo', 'gist', ...]
})
contains(token, ['gist'], function (err, yes) {
console.log(yes)
> true
})
Running the tests
$ TOKEN={some-personal-access-token} REQUIRED_SCOPES={some-comma-delimited-list-of-scopes} npm test
Note: TOKEN
is the only required environment variable.