Skip to content

Commit

Permalink
Fix options in OAuth2 strategy to actually allow scope passing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Bleigh committed Oct 12, 2010
1 parent 4692827 commit 5ad7f4a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.1.3
0.1.4
4 changes: 2 additions & 2 deletions oa-oauth/lib/omniauth/strategies/facebook.rb
Expand Up @@ -24,9 +24,9 @@ def user_data
@data ||= MultiJson.decode(@access_token.get('/me'))
end

def request_phase(options = {})
def request_phase
options[:scope] ||= "email,offline_access"
super(options)
super
end

def user_info
Expand Down
4 changes: 2 additions & 2 deletions oa-oauth/lib/omniauth/strategies/gowalla.rb
Expand Up @@ -26,9 +26,9 @@ def user_data
@data ||= MultiJson.decode(@access_token.get("/users/me.json"))
end

def request_phase(options = {})
def request_phase
options[:scope] ||= "email,offline_access"
super(options)
super
end

def user_info
Expand Down
12 changes: 6 additions & 6 deletions oa-oauth/lib/omniauth/strategies/oauth2.rb
Expand Up @@ -8,6 +8,8 @@ module Strategies
class OAuth2
include OmniAuth::Strategy

attr_accessor :options, :client

class CallbackError < StandardError
attr_accessor :error, :error_reason, :error_uri

Expand All @@ -20,15 +22,13 @@ def initialize(error, error_reason=nil, error_uri=nil)

def initialize(app, name, client_id, client_secret, options = {})
super(app, name)
@options = options
@client = ::OAuth2::Client.new(client_id, client_secret, options)
self.options = options
self.client = ::OAuth2::Client.new(client_id, client_secret, options)
end

protected

attr_accessor :client

def request_phase(options = {})

def request_phase
redirect client.web_server.authorize_url({:redirect_uri => callback_url}.merge(options))
end

Expand Down

0 comments on commit 5ad7f4a

Please sign in to comment.