Skip to content

Commit

Permalink
Fix strip problem with scope; use latest RVM rvmrc
Browse files Browse the repository at this point in the history
  • Loading branch information
myitcv committed Jun 11, 2013
1 parent 54c5bf2 commit f070eb6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby-1.9.3
1 change: 0 additions & 1 deletion .rvmrc

This file was deleted.

5 changes: 4 additions & 1 deletion lib/omniauth/strategies/google_oauth2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def authorize_params
params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
end
scopes = (params[:scope] || DEFAULT_SCOPE).split(",")
scopes.map! { |s| s =~ /^https?:\/\// ? s : "#{base_scope_url}#{s}" }
scopes.map! { |s|
s.strip!
s =~ /^https?:\/\// ? s : "#{base_scope_url}#{s}"
}
params[:scope] = scopes.join(' ')
# This makes sure we get a refresh_token.
# http://googlecode.blogspot.com/2011/10/upcoming-changes-to-oauth-20-endpoint.html
Expand Down

2 comments on commit f070eb6

@nomadmashup
Copy link

Choose a reason for hiding this comment

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

This BROKE the ability to specify multiple scopes!!! If I specify
scope: 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/calendar.readonly',
I get the following error from Google:

Error: invalid_scope
Some requested scopes were invalid. {invalid=[https://www.googleapis.com/auth/userinfo.emailhttps://www.googleapis.com/auth/calendar]}

@zquestz
Copy link
Owner

Choose a reason for hiding this comment

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

The scopes should be comma separated. Thats the issue. The docs are clear that all scopes should be "scope1,scope2,etc", not "scope scope2 etc".

Please sign in to comment.