omniauth-google-oauth2 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1ed28b1b51bd66946f8a20796e451090685c868c6923e18e38fd2476f398989
4
- data.tar.gz: ee9023b2fd1e74bea632aa12d50d411be6d5738bf91da56293470db5cc339720
3
+ metadata.gz: '0532842d8362fc36a8797376dc54e09b1d11fa178d462114225eecbe87274785'
4
+ data.tar.gz: 63b1d0a5a3a6249b77b58cbfa4e696ae18748b59280cb73f36cb98f88abd98c1
5
5
  SHA512:
6
- metadata.gz: 0cf127deee1596814c94521433300e88f965ee762a93f085a07dcf38307a48bdb803f40b6f35bb3611b29aa3349ac0f209ac6da64facb6733620ad820f4f1911
7
- data.tar.gz: 72ce107f30e80fc5564e0fcdea2de7a813f4962ea202aa5076b364cc561d9890e91f2dd1f25736df2238709910cefe800fba6854200e2320a149d596aaec8ef0
6
+ metadata.gz: 6d6f34a8629057f1f89d613155567d0bb50917648794e64527976ba7ca4c372ed8806fd57bbe5cec55d2d60545ef2e9bd038da80e1101b96642018f1d8226951
7
+ data.tar.gz: b00da9be3e3f97af0cdfe9a15be3d99126176a26bc21337febb893be88949da0573b4f6a843fbedac3dc982a4fda29ca532b63d3a1272fc8544468b3a42d32aa
data/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## 1.1.1 - 2022-09-05
5
+
6
+ ### Added
7
+ - Nothing.
8
+
9
+ ### Deprecated
10
+ - Nothing.
11
+
12
+ ### Removed
13
+ - Nothing.
14
+
15
+ ### Fixed
16
+ - Fixed JWT decoding issue. (Invalid segment encoding) [#431](https://github.com/zquestz/omniauth-google-oauth2/pull/431)
17
+
4
18
  ## 1.1.0 - 2022-09-03
5
19
 
6
20
  ### Added
data/examples/Gemfile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- gem 'omniauth-google-oauth2', '~> 0.8.1'
5
+ gem 'omniauth-google-oauth2', '~> 1.1.1'
6
6
  gem 'rubocop'
7
7
  gem 'sinatra', '~> 1.4'
8
8
  gem 'webrick'
data/examples/config.ru CHANGED
@@ -19,6 +19,19 @@ OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
19
19
 
20
20
  # Main example app for omniauth-google-oauth2
21
21
  class App < Sinatra::Base
22
+ configure do
23
+ set :sessions, true
24
+ set :inline_templates, true
25
+ end
26
+
27
+ use Rack::Session::Cookie, secret: ENV['RACK_COOKIE_SECRET']
28
+
29
+ use OmniAuth::Builder do
30
+ # For additional provider examples please look at 'omni_auth.rb'
31
+ # The key provider_ignores_state is only for AJAX flows. It is not recommended for normal logins.
32
+ provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], access_type: 'offline', prompt: 'consent', provider_ignores_state: true, scope: 'email,profile,calendar'
33
+ end
34
+
22
35
  get '/' do
23
36
  <<-HTML
24
37
  <!DOCTYPE html>
@@ -73,7 +86,12 @@ class App < Sinatra::Base
73
86
  </head>
74
87
  <body>
75
88
  <ul>
76
- <li><a href='/auth/google_oauth2'>Sign in with Google</a></li>
89
+ <li>
90
+ <form method='post' action='/auth/google_oauth2'>
91
+ <input type="hidden" name="authenticity_token" value="#{request.env['rack.session']['csrf']}">
92
+ <button type='submit'>Login with Google</button>
93
+ </form>
94
+ </li>
77
95
  <li><a href='#' class="googleplus-login">Sign in with Google via AJAX</a></li>
78
96
  </ul>
79
97
  </body>
@@ -109,12 +127,4 @@ class App < Sinatra::Base
109
127
  end
110
128
  end
111
129
 
112
- use Rack::Session::Cookie, secret: ENV['RACK_COOKIE_SECRET']
113
-
114
- use OmniAuth::Builder do
115
- # For additional provider examples please look at 'omni_auth.rb'
116
- # The key provider_ignores_state is only for AJAX flows. It is not recommended for normal logins.
117
- provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], access_type: 'offline', prompt: 'consent', provider_ignores_state: true, scope: 'email,profile,calendar'
118
- end
119
-
120
130
  run App.new
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module GoogleOauth2
5
- VERSION = '1.1.0'
5
+ VERSION = '1.1.1'
6
6
  end
7
7
  end
@@ -69,9 +69,10 @@ module OmniAuth
69
69
 
70
70
  extra do
71
71
  hash = {}
72
- hash[:id_token] = access_token.token
73
- if !options[:skip_jwt] && !nil_or_empty(access_token.token)
74
- decoded = ::JWT.decode(access_token.token, nil, false).first
72
+ token = nil_or_empty?(access_token['id_token']) ? access_token.token : access_token['id_token']
73
+ hash[:id_token] = token
74
+ if !options[:skip_jwt] && !nil_or_empty?(token)
75
+ decoded = ::JWT.decode(token, nil, false).first
75
76
 
76
77
  # We have to manually verify the claims because the third parameter to
77
78
  # JWT.decode is false since no verification key is provided.
@@ -108,7 +109,7 @@ module OmniAuth
108
109
 
109
110
  private
110
111
 
111
- def nil_or_empty(obj)
112
+ def nil_or_empty?(obj)
112
113
  obj.is_a?(String) ? obj.empty? : obj.nil?
113
114
  end
114
115
 
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: 1.1.0
4
+ version: 1.1.1
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: 2022-09-04 00:00:00.000000000 Z
12
+ date: 2022-09-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jwt