Skip to content
Browse files

fixups so scopes work again

  • Loading branch information...
1 parent b71a87e commit 84a43569d46c1c90c8ec9ef95202185c4bcf89a9 @atmos committed Jun 19, 2010
Showing with 8 additions and 6 deletions.
  1. +3 −3 Gemfile
  2. +2 −2 lib/sinatra/auth/github.rb
  3. +3 −1 spec/app.rb
View
6 Gemfile
@@ -1,8 +1,9 @@
source :gemcutter
group :runtime do
- gem 'sinatra', '~>1.0'
- gem 'warden-github', '~>0.0.5'
+ gem 'sinatra', '~>1.0'
+ gem 'warden-github', '~>0.0.5'
+ gem 'rest-client', '~>1.5.1', :require => 'rest_client'
end
group :test do
@@ -15,7 +16,6 @@ group :test do
gem 'randexp', '~>0.1.5'
gem 'rack-test', '~>0.5.3', :require => 'rack/test'
gem 'ruby-debug'
- gem 'rest-client', '~>1.5.1', :require => 'rest_client'
end
# vim:ft=ruby
View
4 lib/sinatra/auth/github.rb
@@ -33,7 +33,7 @@ def github_user
end
def github_request(path)
- response = RestClient.get("https://github.com/api/v2/json/#{path}", {:accept => :json, :params => {:token => github_user.token}})
+ response = RestClient.get("https://github.com/api/v2/json/#{path}", {:accept => :json, :params => {:access_token => github_user.token}})
JSON.parse(response.body)
end
@@ -49,7 +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_scopes] = 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
4 spec/app.rb
@@ -5,7 +5,9 @@ module Example
class App < Sinatra::Base
enable :sessions
- set :github_options, {:client_id => ENV['GITHUB_CLIENT_ID'], :secret => ENV['GITHUB_SECRET'], :scopes => 'user,offline_access,repo' }
+ set :github_options, { :client_id => ENV['GITHUB_CLIENT_ID'],
+ :secret => ENV['GITHUB_SECRET'],
+ :scopes => 'user,offline_access,repo' }
register Sinatra::Auth::Github

0 comments on commit 84a4356

Please sign in to comment.
Something went wrong with that request. Please try again.