heroku-oauth

1.0.1 • Public • Published

heroku-oauth

simple functions for doing oauth login with heroku. compatible with any node http server that uses handler callbacks that look like function(req, res) {}.

NPM

see also: github-oauth

var herokuOauth = require('heorku-oauth')({
  herokuClient: process.env['HEROKU_CLIENT'],
  baseURL: 'http://localhost',
  loginURI: '/heroku/login', // optional default
  callbackURI: '/heroku/callback', // optional default
  scope: 'global' // optional default
 
require('http').createServer(function(req, res) {
  if (req.url.match(/heroku/login/)) return herokuOAuth.login(req, res)
  if (req.url.match(/heroku/callback/)) return herokuOAuth.callback(req, res)
}).listen(80)
 
herokuOAuth.on('error', function(err) {
  console.error('there was a login error', err)
})
 
herokuOAuth.on('token', function(token, serverResponse) {
  console.log('here is your shiny new heroku oauth token', token)
  serverResponse.end(JSON.stringify(token))
})

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i heroku-oauth

    Weekly Downloads

    1

    Version

    1.0.1

    License

    bsd

    Last publish

    Collaborators

    • karissa