Skip to content

Commit 41bb7e6

Browse files
committed
Resolve conflict between auth_token_params patch and HEAD
2 parents eaa9442 + 89c44d8 commit 41bb7e6

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/omniauth-oauth2/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module OmniAuth
22
module OAuth2
3-
VERSION = "1.1.0"
3+
VERSION = "1.1.1"
44
end
55
end

lib/omniauth/strategies/oauth2.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class OAuth2
2525
option :token_params, {}
2626
option :token_options, []
2727
option :auth_token_params, {}
28+
option :provider_ignores_state, false
2829

2930
attr_accessor :access_token
3031

@@ -49,9 +50,7 @@ def request_phase
4950
end
5051

5152
def authorize_params
52-
if options.authorize_params[:state].to_s.empty?
53-
options.authorize_params[:state] = SecureRandom.hex(24)
54-
end
53+
options.authorize_params[:state] = SecureRandom.hex(24)
5554
params = options.authorize_params.merge(options.authorize_options.inject({}){|h,k| h[k.to_sym] = options[k] if options[k]; h})
5655
if OmniAuth.config.test_mode
5756
@env ||= {}
@@ -69,7 +68,7 @@ def callback_phase
6968
if request.params['error'] || request.params['error_reason']
7069
raise CallbackError.new(request.params['error'], request.params['error_description'] || request.params['error_reason'], request.params['error_uri'])
7170
end
72-
if request.params['state'].to_s.empty? || request.params['state'] != session.delete('omniauth.state')
71+
if !options.provider_ignores_state && (request.params['state'].to_s.empty? || request.params['state'] != session.delete('omniauth.state'))
7372
raise CallbackError.new(nil, :csrf_detected)
7473
end
7574

0 commit comments

Comments
 (0)