Permalink
Browse files

Merge pull request #452 from soorajb/master

Most Google Oauth2 API not working - Google Email scope fix
  • Loading branch information...
2 parents 2a3e8ba + 6be3bf0 commit d5b1bb634721f75b641f151d12ae21da98b1f619 @sferik sferik committed Sep 2, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 oa-oauth/lib/omniauth/strategies/google_oauth2.rb
@@ -20,7 +20,9 @@ def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
end
def request_phase
- options[:scope] ||= "https://www.googleapis.com/auth/userinfo.email"
+ google_email_scope = "www.googleapis.com/auth/userinfo.email"
+ options[:scope] ||= "https://#{google_email_scope}"
+ options[:scope] << "https://#{google_email_scope}" unless options[:scope] =~ %r[http[s]?:\/\/#{google_email_scope}]
redirect client.auth_code.authorize_url(
{:redirect_uri => callback_url, :response_type => "code"}.merge(options))
end

0 comments on commit d5b1bb6

Please sign in to comment.