Skip to content

okdistribute/heroku-oauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

#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))
})

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published