GithubEmployeeAuth

This is what you should be using if you're writing internal applications in Sinatra.

Installation

Add this line to your application's Gemfile:

gem 'github_employee_auth'

And then execute:

$ bundle

Or install it yourself as:

$ gem install github_employee_auth

Usage

Create a new OAuth application under the GitHub organization's settings for your application. If your application's Main URL was http://yourapp.githubapp.com, then the Callback URL should be http://yourapp.githubapp.com/auth/github/callback.

After doing that, just require the github_employee_auth library, register it, and then call github_employee_auth! wherever needed:

  require "github_employee_auth"

  class InternalApp < Sinatra::Base
    enable :sessions
    # For shogtun reloading set a session secret
    # set :session_secret, 'codereloading'

    register GitHub::Employee::Auth

    get "/"
      github_employee_auth!
    end
  end

For this to work, you'll need to pass the GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET environment variables into your application. You can find those values on the OAuth application page you created earlier.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request