JSPM

  • Created
  • Published
  • Downloads 424499
  • Score
    100M100P100Q168657F

Node.js client for OAuth2

Package Exports

  • simple-oauth2

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-oauth2) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Simple OAuth2

Node.js client library for Oauth2. Currently it supports Authorization Code and Resource Owner Password Credentials grant types.

Requirements

Node client library is tested against Node ~0.8.x

Installation

Install the client library using npm:

$ npm install simple-oath2

Install the client library using git:

$ git clone git://github.com/andrearegianto/simple-oauth2.git
$ cd simple-oauth2
$ npm install

Getting started

var credentials = { client: { id: 'client-id', secret: 'client-secret', site: 'https://example.org' } };
var OAuth2 = require('simple-oauth2')(credentials);

// Returns the URI where to redirect your app
var redirect = Oauth2.AuthCode.authorizeURL({ redirectURI: 'http://localhost:3000/callback', scope: 'user', state: '02afe928b');
// => "https://example.org/oauth/authorization?response_type=code&client_id=client_id&redirect_uri=http://localhost:3000/callback&scope=user&state=02afe928b"

// Get the access token object
vat params = { code: 'authorization-code', redirectURI: 'http://localhost:3000/callback' }
OAuth2.AuthCode.getToken(params, function(error, result) {
  // save the token
})

Documentation

Check out the complete Simple Oauth2 Documentation

Contributing

Fork the repo on github and send a pull requests with topic branches. Do not forget to provide specs to your contribution.

Running specs

  • Fork and clone the repository (dev branch).
  • Run npm install for dependencies.
  • Run make test to execute all specs.
  • Run make test-watch to auto execute all specs when a file change.

Coding guidelines

Follow github guidelines.

Feedback

Use the issue tracker for bugs. Mail or Tweet us for any idea that can improve the project.

Authors

Andrea Reginato

Contributors

Special thanks to the following people for submitting patches.

Changelog

See CHANGELOG

Copyright (c) 2013 Lelylan. See LICENSE for details.