Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
85 lines (59 sloc) 1.29 KB


A simple Node.js library for getting an Oauth token for Github with a username and password


Install with npm

npm install -S octoauth   # -S adds octoauth to your package.json for you


You can instantiate octOAuth and pass a hash in with values you want

var octOAuth = require('octoauth');

var params = {
  username: 'taterbase',
  password: 'password',
  scopes: [ 'gist' ]

var oa = new octOAuth(params);

Or you can assign them later

var oa = new octOAuth();

oa.username = 'taterbase';
oa.password = 'password';
oa.scopes = ['gist', 'repo'];

You can even mix and match

var params = {
  username: 'taterbase',
  password: 'password'

var oa = new octOAuth(params);

oa.scopes = [ 'gist' ];

After that just call getToken

oa.getToken(function(err, token){
  //Use that token!


To run tests this module needs a config folder structured like so:


Inside config/index.js you should expose an object with working username and password like so:

module.exports = {
  username: 'taterbase',
  password: '123Fake'

Now you can run mocha and test away.

MIT license

Something went wrong with that request. Please try again.