New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

github-oauth

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-oauth

simple functions for doing oauth login with github

latest
Source
npmnpm
Version
0.2.2
Version published
Weekly downloads
46
-49.45%
Maintainers
1
Weekly downloads
 
Created
Source

github-oauth

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

usage

var githubOAuth = require('github-oauth')({
  githubClient: process.env['GITHUB_CLIENT'],
  githubSecret: process.env['GITHUB_SECRET'],
  baseURL: 'http://localhost',
  loginURI: '/login',
  callbackURI: '/callback',
  scope: 'user' // optional, default scope is set to user
})

require('http').createServer(function(req, res) {
  if (req.url.match(/login/)) return githubOAuth.login(req, res)
  if (req.url.match(/callback/)) return githubOAuth.callback(req, res)
}).listen(80)

githubOAuth.on('error', function(err) {
  console.error('there was a login error', err)
})

githubOAuth.on('token', function(token, serverResponse) {
  console.log('here is your shiny new github oauth token', token)
  serverResponse.end(JSON.stringify(token))
})

// now go to http://localhost/login

If you want to support no scope, pass in scope: ''

bonus feature

  githubOauth.addRoutes(myAppRouter)
  // where myAppRouter is a router that will work with:
  // myAppRouter.get('/github/login', function(req, res) {})
  // http://github.com/flatiron/director works like this
  
  // or even more bonus:
  githubOauth.addRoutes(myAppRouter, function(err, token, serverResponse, tokenResponse) {
    
  })
  

license

BSD LICENSED

Keywords

github

FAQs

Package last updated on 04 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts