Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 27 lines (21 sloc) 0.484 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
module Example
  class App < Sinatra::Base
    enable :sessions

    set :github_options, {:client_id => ENV['GH_CLIENT_ID'],
                           :secret => ENV['GH_SECRET'] }

    register Sinatra::Auth::Github

    before do
      authenticate!
    end

    get '/' do
      "Hello There, #{github_user.name}!"
    end

    get '/another_route' do
      "Hello There, #{github_user.name}!"
    end

    get '/logout' do
      logout!
      redirect '/'
    end
  end
end
Something went wrong with that request. Please try again.