omniauth-google-oauth2 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTE1ZjFkZmYyYTNlM2I4MTI5NmM2MmZlMWFlYjZmNjQ2YjNhNDU1MA==
4
+ ZmVkNzJkYzQ3MzVkNjNhMWUwZWE4YWQyNzlmZGJlNmJjYjI2ZjQwMw==
5
5
  data.tar.gz: !binary |-
6
- OTNiNzQ4MGVhMmFkODVhZGU3Yjk0ZTFjNmY1ZDlkNjM5ZTUwMTFkOA==
6
+ ZjA0Y2Q2Mzc4ZmMyNTFhZTY0NDUxOThmYmY4MTM1MDllMGUwMWE5Yg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZGI2YjNkMWU5MzRjNzcyYjIxZTE1NGJhMTFkNWNmZDZmMGU1NjczODAwZjUz
10
- Y2U5YWE5ZjU3ZDY4NTc5YTVhMmUyZmNhOTk0M2VjZmY3MTc5YzI4MzRiOWEw
11
- MDZmY2YwNTE2YmQ1MGRiNDg5ZTBlNzI3OWU5ZDBkNmQ1NjNjOWM=
9
+ MTI1Y2EwZTY3Mjk5ZTIzNGE4ZjRhZTc1YjY5NmE0ODJjNTNjYWQ0MzRkZmQ1
10
+ OWU0ZTVmMTJmNzJjNDMwYWQzM2I3NzVmZGJhMjYyZGM1Y2UwNmI5ODNhZTA0
11
+ MmIzZWQ5NzJiNTNkNzc3YjE4MTRlNjUxYWRkNGViOWNjYWJhZTM=
12
12
  data.tar.gz: !binary |-
13
- YTViOTc3NTgwMTJjYjg0NjhhZDJhYzRlM2E4MmMyZjA2NWQ4YWQ1NWRmODAy
14
- YjZlYjQ3OTkxYjRjNTAxNWQwMTVkN2E5ZDhlZDI1ZTg4Y2ZkNTBjYmRiYTYx
15
- MjU2N2Q5ZGQxNzVjZWViNDQ4YjM3ZjQ1OGZkMGY3YTk5N2RiNDk=
13
+ ZDk4MDhmZGU5OTAzODI3MzhlODQ5YWRmNTM4YzVhNmQ2ZjQxZDMwMjg1Mjg1
14
+ NDk1ODFhOWZmOWE4MjJmMjkzMzBhN2U4OTg2OTY2M2Q3MDEyM2U0NTU2NGI0
15
+ ZDcxZTIzOTRhMTVkZTFiODY1MGMyMTk2OTVhNjhhMmZkZDIwNmE=
data/README.md CHANGED
@@ -37,7 +37,7 @@ NOTE: While developing your application, if you change the scope in the initiali
37
37
  You can configure several options, which you pass in to the `provider` method via a hash:
38
38
 
39
39
  * `scope`: A comma-separated list of permissions you want to request from the user. See the [Google OAuth 2.0 Playground](https://developers.google.com/oauthplayground/) for a full list of available permissions. Caveats:
40
- * The `userinfo.email` and `userinfo.profile` scopes are used by default. By defining your own `scope`, you override these defaults. If you need these scopes, don't forget to add them yourself!
40
+ * The `email` and `profile` scopes are used by default. By defining your own `scope`, you override these defaults. If you need these scopes, don't forget to add them yourself!
41
41
  * Scopes starting with `https://www.googleapis.com/auth/` do not need that prefix specified. So while you can use the smaller scope `books` since that permission starts with the mentioned prefix, you should use the full scope URL `https://docs.google.com/feeds/` to access a user's docs, for example.
42
42
  * `prompt`: A space-delimited list of string values that determines whether the user is re-prompted for authentication and/or consent. Possible values are:
43
43
  * `none`: No authentication or consent pages will be displayed; it will return an error if the user is not already authenticated and has not pre-configured consent for the requested scopes. This can be used as a method to check for existing authentication and/or consent.
@@ -69,7 +69,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do
69
69
  provider :google_oauth2, ENV["GOOGLE_CLIENT_ID"], ENV["GOOGLE_CLIENT_SECRET"],
70
70
  {
71
71
  :name => "google",
72
- :scope => "userinfo.email, userinfo.profile, plus.me, http://gdata.youtube.com",
72
+ :scope => "email, profile, plus.me, http://gdata.youtube.com",
73
73
  :prompt => "select_account",
74
74
  :image_aspect_ratio => "square",
75
75
  :image_size => 50
@@ -100,13 +100,13 @@ Here's an example of an authentication hash available in the callback by accessi
100
100
  },
101
101
  :extra => {
102
102
  :raw_info => {
103
- :id => "123456789",
103
+ :sub => "123456789",
104
104
  :email => "user@domain.example.com",
105
- :verified_email => true,
105
+ :email_verified => true,
106
106
  :name => "John Doe",
107
107
  :given_name => "John",
108
108
  :family_name => "Doe",
109
- :link => "https://plus.google.com/123456789",
109
+ :profile => "https://plus.google.com/123456789",
110
110
  :picture => "https://lh3.googleusercontent.com/url/photo.jpg",
111
111
  :gender => "male",
112
112
  :birthday => "0000-06-25",
data/examples/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'sinatra'
4
+ gem 'omniauth-google-oauth2'
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module GoogleOauth2
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.4"
4
4
  end
5
5
  end
@@ -95,6 +95,7 @@ module OmniAuth
95
95
 
96
96
  def image_url
97
97
  original_url = raw_info['picture']
98
+ original_url = original_url.gsub("https:https://", "https://") if original_url
98
99
  params_index = original_url.index('/photo.jpg') if original_url
99
100
 
100
101
  if params_index && image_size_opts_passed?
@@ -391,8 +391,8 @@ describe OmniAuth::Strategies::GoogleOauth2 do
391
391
 
392
392
  it 'should return original image if image url does not end in `photo.jpg`' do
393
393
  @options = {:image_size => 50}
394
- subject.stub(:raw_info) { {'picture' => 'https://lh3.googleusercontent.com/url/photograph.jpg'} }
395
- subject.info[:image].should eq('https://lh3.googleusercontent.com/url/photograph.jpg')
394
+ allow(subject).to receive(:raw_info) { {'picture' => 'https://lh3.googleusercontent.com/url/photograph.jpg'} }
395
+ expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/url/photograph.jpg')
396
396
  end
397
397
  end
398
398
 
@@ -400,6 +400,11 @@ describe OmniAuth::Strategies::GoogleOauth2 do
400
400
  allow(subject).to receive(:raw_info) { {'picture' => 'https://lh3.googleusercontent.com/url/photo.jpg'} }
401
401
  expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/url/photo.jpg')
402
402
  end
403
+
404
+ it 'should return correct image if google image url has double https' do
405
+ allow(subject).to receive(:raw_info) { {'picture' => 'https:https://lh3.googleusercontent.com/url/photo.jpg'} }
406
+ expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/url/photo.jpg')
407
+ end
403
408
  end
404
409
 
405
410
  describe 'build_access_token' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-google-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Ellithorpe
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-17 00:00:00.000000000 Z
12
+ date: 2014-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
@@ -79,6 +79,7 @@ files:
79
79
  - Gemfile
80
80
  - README.md
81
81
  - Rakefile
82
+ - examples/Gemfile
82
83
  - examples/config.ru
83
84
  - examples/omni_auth.rb
84
85
  - lib/omniauth-google-oauth2.rb