Skip to content

Commit 3677e2e

Browse files
committed
fix broken backward compatibility
(by default, keep the same callback_url in callback_phase and request_phase)
1 parent 464fcef commit 3677e2e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/omniauth/strategies/oauth2.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def self.inherited(subclass)
2929
option :token_options, []
3030
option :auth_token_params, {}
3131
option :provider_ignores_state, false
32+
option :include_query_string, false
3233

3334
attr_accessor :access_token
3435

@@ -86,7 +87,8 @@ def callback_phase # rubocop:disable AbcSize, CyclomaticComplexity, MethodLength
8687

8788
def build_access_token
8889
verifier = request.params["code"]
89-
client.auth_code.get_token(verifier, {:redirect_uri => callback_url}.merge(token_params.to_hash(:symbolize_keys => true)), deep_symbolize(options.auth_token_params))
90+
url = options.include_query_string ? callback_url : (full_host + script_name + callback_path)
91+
client.auth_code.get_token(verifier, {:redirect_uri => url}.merge(token_params.to_hash(:symbolize_keys => true)), deep_symbolize(options.auth_token_params))
9092
end
9193

9294
def deep_symbolize(options)

0 commit comments

Comments
 (0)