Permalink
Browse files

support github scopes now too

  • Loading branch information...
1 parent 6e0471f commit 5aaeb00880200f86633b009be20eb6e59d4abfc1 @atmos committed Jun 18, 2010
Showing with 3 additions and 2 deletions.
  1. +1 −0 lib/sinatra/auth/github.rb
  2. +2 −2 spec/app.rb
@@ -49,6 +49,7 @@ def self.registered(app)
manager.failure_app = app.github_options[:failure_app] || BadAuthentication
manager[:github_secret] = app.github_options[:secret]
+ manager[:github_callback_url] = app.github_options[:scopes] || 'email,offline_access'
manager[:github_client_id] = app.github_options[:client_id]
manager[:github_callback_url] = app.github_options[:callback_url] || '/auth/github/callback'
end
View
@@ -5,7 +5,7 @@ module Example
class App < Sinatra::Base
enable :sessions
- set :github_options, {:client_id => ENV['GH_CLIENT_ID'], :secret => ENV['GH_SECRET'] }
+ set :github_options, {:client_id => ENV['GITHUB_CLIENT_ID'], :secret => ENV['GITHUB_SECRET'], :scopes => 'user,offline_access,repo' }
register Sinatra::Auth::Github
@@ -20,7 +20,7 @@ def repos
end
get '/' do
- "Hello There, #{github_user.name}!\n#{repos.inspect}"
+ "Hello There, #{github_user.name}!#{github_user.token}\n#{repos.inspect}"
end
get '/logout' do

0 comments on commit 5aaeb00

Please sign in to comment.