Skip to content

A simple Node.js library for getting an OAuth token for github.

Notifications You must be signed in to change notification settings

taterbase/node-octoauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#octOAuth

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

##Installation

Install with npm

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

##Usage

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!
});

##Testing

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

node-octoauth
|
+--config
    |
    +--index.js

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

About

A simple Node.js library for getting an OAuth token for github.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published