Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Enables client-side applications to dance OAuth with GitHub.

branch: master


Because of some security-related limitations, Github prevents you from implementing the OAuth Web Application Flow on a client-side only application.

This is a real bummer. So we built Gatekeeper, which is the missing piece you need in order to make it work.

Gatekeeper works well with Github.js, which helps you accessing the Github API from the browser.


GET http://localhost:9999/authenticate/TEMPORARY_CODE

OAuth Steps

Also see the documentation on Github.

  1. Redirect users to request GitHub access.

  2. GitHub redirects back to your site including a temporary code you need for the next step.

    You can grab it like so:

    var code = window.location.href.match(/\?code=(.*)/)[1];
  3. Request the actual token using your instance of Gatekeeper, which knows your client_secret.

    $.getJSON('http://localhost:9999/authenticate/'+code, function(data) {

Setup your Gatekeeper

  1. Clone it

    git clone
  2. Install Dependencies

    cd gatekeeper && npm install
  3. Adjust config.json

     "host": "",
     "port": 443,
     "path": "/login/oauth/access_token",
     "method": "POST",
     "server": {
       "port": 9999

    You can also set environment variables to override the settings if you don't want Git to track your adjusted config.json file. Just use UPPER_CASE keys.

  4. Serve it

    $ node server.js

Deploy on Heroku

  1. Create a new Heroku app

    cake heroku:create
  2. Rename it (optional)

    heroku apps:rename NEW_NAME

    cake -c OAUTH_CLIENT_ID -s OAUTH_CLIENT_SECRET heroku:config
  4. Push changes to heroku

    cake heroku:push
Something went wrong with that request. Please try again.