Giter Site home page Giter Site logo

gatekeeper's Introduction

Gatekeeper

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.

API

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

OAuth Steps

Also see the documentation on Github.

  1. Redirect users to request GitHub access.

    GET https://github.com/login/oauth/authorize
    
  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/'+clientId+'/'+code, function(data) {
      console.log(data.token);
    });

Setup your Gatekeeper

  1. Clone it

    git clone [email protected]:prose/gatekeeper.git
    
  2. Install Dependencies

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

     {
       "port": 9999,
       "apps": [
         {
           "oauth_client_id": "GITHUB_APPLICATION_CLIENT_ID",
           "oauth_client_secret": "GITHUB_APPLICATION_CLIENT_SECRET",
           "oauth_host": "github.enterprise.fr",
           "oauth_port": 443,
           "oauth_path": "/login/oauth/access_token",
           "oauth_method": "POST"
         },
         {
           "oauth_client_id": "GITHUB_APPLICATION_CLIENT_ID",
           "oauth_client_secret": "GITHUB_APPLICATION_CLIENT_SECRET",
           "oauth_host": "github.com",
           "oauth_port": 443,
           "oauth_path": "/login/oauth/access_token",
           "oauth_method": "POST"
         }
       ]
     }
  4. Serve it

    $ node server.js
    

Deploy on Heroku

Heroku Button

Use the button below to instantly setup your own Gatekeeper instance on Heroku.

Deploy

Heroku manually

  1. Create a new Heroku app

    heroku apps:create APP_NAME
    
  2. Adjust config.json

  3. Push changes to heroku

    git push heroku master
    

##Deploy on Azure

Azure Button

Use the button below to instantly setup your own Gatekeeper instance on Azure.

Deploy to Azure

Azure manually

  1. Create a new Azure site

    azure site create SITE_NAME --git
    
  2. Adjust config.json

  3. Push changes to Azure

    git push azure master
    

gatekeeper's People

Contributors

michael avatar zzolo avatar antoinereneleau avatar wrynearson avatar shyykoserhiy avatar marcqualie avatar tmcw avatar tristen avatar

Stargazers

Kaelig Deloumeau-Prigent avatar

Watchers

Mikael RANDY avatar Matthieu Guillermin avatar Jérôme Foray avatar Jean-Baptiste avatar ludovic avatar James Cloos avatar Lucas Courot avatar Stéphane Douzima avatar Kenny Dits @kenny_dee avatar  avatar Florian FERRIERE avatar  avatar Florent Dubost avatar Valentin C. avatar Fabien de Saint pern avatar BOUYGE avatar Nicolas Afresne avatar Thierry Geindre avatar  avatar Nastasia Saby avatar  avatar Héléna Hiraux avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.