Sha256: 77560fb4abb009170469ca31acc06b9f62e620e463f46876aa28a1f4137d74be
Contents?: true
Size: 1.09 KB
Versions: 5
Compression:
Stored size: 1.09 KB
Contents
require 'pp' require 'debugger' module Example class App < Sinatra::Base enable :sessions set :github_options, { :scopes => "user", :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.login}!" end get '/orgs/:id' do github_organization_authenticate!(params['id']) "Hello There, #{github_user.name}! You have access to the #{params['id']} organization." end get '/publicized_orgs/:id' do github_publicized_organization_authenticate!(params['id']) "Hello There, #{github_user.name}! You are publicly a member of the #{params['id']} organization." end 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
5 entries across 5 versions & 1 rubygems