omniauth-google-oauth2 0.2.4 → 0.2.5

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
- ZmVkNzJkYzQ3MzVkNjNhMWUwZWE4YWQyNzlmZGJlNmJjYjI2ZjQwMw==
4
+ NTk1MjVmMTBjYzEwZTlmMWJhMTljOTlmM2VmNGM1OTE0Y2MxMjYyMg==
5
5
  data.tar.gz: !binary |-
6
- ZjA0Y2Q2Mzc4ZmMyNTFhZTY0NDUxOThmYmY4MTM1MDllMGUwMWE5Yg==
6
+ ZGUzNTYzZjQzYzZkNjE0MTlmOThkZjQ0ZWVlMWYxMDQ4Mzg2YzRmNg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTI1Y2EwZTY3Mjk5ZTIzNGE4ZjRhZTc1YjY5NmE0ODJjNTNjYWQ0MzRkZmQ1
10
- OWU0ZTVmMTJmNzJjNDMwYWQzM2I3NzVmZGJhMjYyZGM1Y2UwNmI5ODNhZTA0
11
- MmIzZWQ5NzJiNTNkNzc3YjE4MTRlNjUxYWRkNGViOWNjYWJhZTM=
9
+ MjJiYzhkYmQ4N2JkMDQ3ODA4YWU2MjE5ZjhiZTY2YTYwOGEwYzAyMjU3ZDFm
10
+ ZjhhNDE2YmVmZjY0YmJjMTU4MDQ0NGIyYWE4YTkyNmU1Y2ZkOWM5NGQyYmVh
11
+ Y2ViNTg5NTMzZjBhMmU4YzRhOWMyOGNmZjJhNzlhMGU2ZDE5MTE=
12
12
  data.tar.gz: !binary |-
13
- ZDk4MDhmZGU5OTAzODI3MzhlODQ5YWRmNTM4YzVhNmQ2ZjQxZDMwMjg1Mjg1
14
- NDk1ODFhOWZmOWE4MjJmMjkzMzBhN2U4OTg2OTY2M2Q3MDEyM2U0NTU2NGI0
15
- ZDcxZTIzOTRhMTVkZTFiODY1MGMyMTk2OTVhNjhhMmZkZDIwNmE=
13
+ YzczYTdkNGZmYWUzNDdjMWEwMzRhY2ZlYzJjY2UwOTA0OGQ4NDlhYzhhNzI5
14
+ YTc0NWNhOWQ5N2I3YjVmY2U1NjUxMDI2MzY3MTJiMmY2NGQ1MmQ1ZDNkMzYy
15
+ MjM0Y2FmM2M2MTc2ZjM3ZTk2Mjc1NDBjYmUzMjkwMmJlNzRlMDI=
data/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ ## 0.2.5 - 2014-07-09
5
+
6
+ ### Added
7
+ - Support for versions of omniauth past 1.0.x.
8
+
9
+ ### Deprecated
10
+ - Nothing.
11
+
12
+ ### Removed
13
+ - Nothing.
14
+
15
+ ### Fixed
16
+ - Nothing.
17
+
18
+ ## 0.2.4 - 2014-04-25
19
+
20
+ ### Added
21
+ - Now requiring the "Contacts API" and "Google+ API" to be enabled in your Google API console.
22
+
23
+ ### Deprecated
24
+ - The old Google OAuth API support was removed without deprecation.
25
+
26
+ ### Removed
27
+ - Support for the old Google OAuth API. `OAuth2::Error` will be thrown and state that access is not configured when you attempt to authenticate using the old API. See Added section for this release.
28
+
29
+ ### Fixed
30
+ - Nothing.
data/README.md CHANGED
@@ -4,6 +4,8 @@ Strategy to authenticate with Google via OAuth2 in OmniAuth.
4
4
 
5
5
  Get your API key at: https://code.google.com/apis/console/ Note the Client ID and the Client Secret.
6
6
 
7
+ **Note**: You must enable the "Contacts API" and "Google+ API" via the Google API console. Otherwise, you will receive an `OAuth2::Error` stating that access is not configured when you attempt to authenticate.
8
+
7
9
  For more details, read the Google docs: https://developers.google.com/accounts/docs/OAuth2
8
10
 
9
11
  ## Installation
@@ -16,6 +18,15 @@ gem "omniauth-google-oauth2"
16
18
 
17
19
  Then `bundle install`.
18
20
 
21
+ ## Google API Setup
22
+
23
+ * Go to 'https://console.developers.google.com'
24
+ * Select your project.
25
+ * Click 'APIs & auth'
26
+ * Make sure "Contacts API" and "Google+ API" are on.
27
+ * Go to Consent Screen, and provide a 'PRODUCT NAME'
28
+ * Wait 10 minutes for changes to take effect.
29
+
19
30
  ## Usage
20
31
 
21
32
  Here's an example for adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
@@ -30,7 +41,7 @@ You can now access the OmniAuth Google OAuth2 URL: `/auth/google_oauth2`
30
41
 
31
42
  For more examples please check out `examples/omni_auth.rb`
32
43
 
33
- NOTE: While developing your application, if you change the scope in the initializer you will need to restart your app server.
44
+ NOTE: While developing your application, if you change the scope in the initializer you will need to restart your app server. Remember that 'email' and 'profile' scopes are required!
34
45
 
35
46
  ## Configuration
36
47
 
@@ -145,12 +156,13 @@ def self.find_for_google_oauth2(access_token, signed_in_resource=nil)
145
156
  data = access_token.info
146
157
  user = User.where(:email => data["email"]).first
147
158
 
148
- unless user
149
- user = User.create(name: data["name"],
150
- email: data["email"],
151
- password: Devise.friendly_token[0,20]
152
- )
153
- end
159
+ # Uncomment the section below if you want users to be created if they don't exist
160
+ # unless user
161
+ # user = User.create(name: data["name"],
162
+ # email: data["email"],
163
+ # password: Devise.friendly_token[0,20]
164
+ # )
165
+ # end
154
166
  user
155
167
  end
156
168
  ```
@@ -193,6 +205,7 @@ window.gpAsyncInit = function() {
193
205
  jQuery.ajax({type: 'POST', url: "/auth/google_oauth2/callback", dataType: 'json', data: response,
194
206
  success: function(json) {
195
207
  // response from server
208
+ }
196
209
  });
197
210
  } else {
198
211
  // google authentication failed
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module GoogleOauth2
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.5"
4
4
  end
5
- end
5
+ end
@@ -2,7 +2,7 @@
2
2
  require File.expand_path(File.join('..', 'lib', 'omniauth', 'google_oauth2', 'version'), __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.add_dependency 'omniauth', '~> 1.0'
5
+ gem.add_dependency 'omniauth', '> 1.0'
6
6
 
7
7
  gem.authors = ["Josh Ellithorpe", "Yury Korolev"]
8
8
  gem.email = ["quest@mac.com"]
@@ -272,7 +272,7 @@ describe OmniAuth::Strategies::GoogleOauth2 do
272
272
  end
273
273
  let(:access_token) { OAuth2::AccessToken.from_hash(client, {}) }
274
274
 
275
- before { subject.stub(:access_token => access_token) }
275
+ before { allow(subject).to receive(:access_token).and_return(access_token) }
276
276
 
277
277
  describe 'id_token' do
278
278
  context 'when the id_token is passed into the 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.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Ellithorpe
@@ -9,20 +9,20 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-25 00:00:00.000000000 Z
12
+ date: 2014-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - ! '>'
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - ! '>'
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.0'
28
28
  - !ruby/object:Gem::Dependency
@@ -76,6 +76,7 @@ extra_rdoc_files: []
76
76
  files:
77
77
  - .gitignore
78
78
  - .travis.yml
79
+ - CHANGELOG.md
79
80
  - Gemfile
80
81
  - README.md
81
82
  - Rakefile