Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A simple Node.js library for getting an OAuth token for github.
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
README.md
index.js
package.json

README.md

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

Something went wrong with that request. Please try again.