Skip to content

Commit

Permalink
Allow for user setting of Google OAuth scope. Closes #171.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Bleigh committed Feb 11, 2011
1 parent a504c17 commit fcc09a5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion oa-oauth/lib/omniauth/strategies/google.rb
Expand Up @@ -20,6 +20,8 @@ def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &bl
:authorize_path => '/accounts/OAuthAuthorizeToken'
}

options[:scope] ||= "http://www.google.com/m8/feeds"

super(app, :google, consumer_key, consumer_secret, client_options, options)
end

Expand Down Expand Up @@ -58,7 +60,7 @@ def user_hash

# Monkeypatch OmniAuth to pass the scope in the consumer.get_request_token call
def request_phase
request_token = consumer.get_request_token({:oauth_callback => callback_url}, {:scope => "http://www.google.com/m8/feeds"})
request_token = consumer.get_request_token({:oauth_callback => callback_url}, {:scope => options[:scope]})

(session['oauth']||={})[name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
r = Rack::Response.new
Expand Down

1 comment on commit fcc09a5

@iamwilhelm
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 This is so awesome. I had to monkey patch it before.

Please sign in to comment.