From fa374ab629eb6ac948e30d3bfb5730428e1f7db8 Mon Sep 17 00:00:00 2001 From: Sooraj Balakrishnan Date: Sat, 3 Sep 2011 00:20:29 +0530 Subject: [PATCH 1/2] Fix for google email scope. --- oa-oauth/lib/omniauth/strategies/google_oauth2.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oa-oauth/lib/omniauth/strategies/google_oauth2.rb b/oa-oauth/lib/omniauth/strategies/google_oauth2.rb index 705088de5..7327a6aaf 100644 --- a/oa-oauth/lib/omniauth/strategies/google_oauth2.rb +++ b/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 = "https://www.googleapis.com/auth/userinfo.email" + options[:scope] ||= google_email_scope + options[:scope] << "#{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 From 6be3bf0bffa376c9706c87dec2f30bde055c3de5 Mon Sep 17 00:00:00 2001 From: Sooraj Balakrishnan Date: Sat, 3 Sep 2011 00:49:25 +0530 Subject: [PATCH 2/2] Update to google email scope url --- oa-oauth/lib/omniauth/strategies/google_oauth2.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oa-oauth/lib/omniauth/strategies/google_oauth2.rb b/oa-oauth/lib/omniauth/strategies/google_oauth2.rb index 7327a6aaf..733031561 100644 --- a/oa-oauth/lib/omniauth/strategies/google_oauth2.rb +++ b/oa-oauth/lib/omniauth/strategies/google_oauth2.rb @@ -20,9 +20,9 @@ def initialize(app, client_id = nil, client_secret = nil, options = {}, &block) end def request_phase - google_email_scope = "https://www.googleapis.com/auth/userinfo.email" - options[:scope] ||= google_email_scope - options[:scope] << "#{google_email_scope}" unless options[:scope] =~ %r[http[s]?:\/\/#{google_email_scope}] + 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