ghauth
Create and load persistent GitHub authentication tokens for command-line apps
Example usage
const ghauth = require('ghauth')
, authOptions = {
configName : 'awesome'
, scopes : [ 'user' ]
, note : 'This token is for my awesome app'
, userAgent : 'My Awesome App'
}
ghauth(authOptions, function (err, authData) {
console.log(authData)
})
Will run something like this:
$ node awesome.js
GitHub username: rvagg
GitHub password: ✔✔✔✔✔✔✔✔✔✔✔✔
GitHub OTP (optional): 669684
{ user: 'rvagg',
token: '24d5dee258c64aef38a66c0c5eca459c379901c2' }
Because the token is persisted, the next time you run it there will be no prompts:
$ node awesome.js
{ user: 'rvagg',
token: '24d5dee258c64aef38a66c0c5eca459c379901c2' }
Optionally persistency can be turned off by setting the option 'noSave'
to true
.
However only use this if you are sure about it, since repeating GitHub authentications
will be rejected by the API.
License
ghauth is Copyright (c) 2014 Rod Vagg @rvagg and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.