Sha256: cdad4582b602735d9ba84a83e6ae4b3ab0005e0038098678b36b462daf4ff212
Contents?: true
Size: 989 Bytes
Versions: 2
Compression:
Stored size: 989 Bytes
Contents
require 'pp' require 'ruby-debug' module Example class App < Sinatra::Base enable :sessions set :github_options, { :secret => ENV['GITHUB_CLIENT_SECRET'], :client_id => ENV['GITHUB_CLIENT_ID'], } register Sinatra::Auth::Github helpers do def repos github_request("user/repos") end end get '/' do authenticate! "Hello There, #{github_user.name}!#{github_user.token}\n#{repos.inspect}" end get '/orgs/:id' do github_public_organization_authenticate!(params['id']) "Hello There, #{github_user.name}! You have access to the #{params['id']} organization." end # the scopes above need to include repo for team access :( # get '/teams/:id' do # github_team_authenticate!(params['id']) # "Hello There, #{github_user.name}! You have access to the #{params['id']} team." # end get '/logout' do logout! redirect 'https://github.com' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sinatra_auth_github-0.4.2 | spec/app.rb |
sinatra_auth_github-0.4.0 | spec/app.rb |