GitHub Open Authentication Module

GitHub OAuth Module for NodeJS

This module gives you the ability to authenticate a user using the GitHub API.

The implementation is not complete. You can't provide scopes and it doesn't handle state right now.

Note: All Examples here are written in CoffeeScript.

npm install github_auth
GitHub = require 'github_auth'
github = new GitHub app_idapp_secret

This is the link your users will click to go to and authorize your app.

link =

The GitHub API calls back your application with a code in the query. You need to just take the code parameter from the query and pass it to the login function.


callback provides token as the parameter.

app.get '/login'(req, res, next) ->
    if req.query && req.query.code
        github.login req.query.code(token) ->
            console.log token
            # Now you have the token. 
            # Save it in your database. 
    else next()



Copyright © 2012 Arjun Bajaj
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.