Skip to content

Commit 42df4f4

Browse files
committed
Add token request parameters for authorization code flow
The access token request needs the code if we're using code flow. For authorization code flow, grant_type and redirect_uri are also required. See https://docs.duendesoftware.com/identityserver/v7/reference/endpoints/token/ To run tests, pin the minitest version per a conflict with mocha, as noted here: freerange/mocha#614 But do not leave pinned as the gem fails to install under some rubies that previously succeeded. For example: net-imap-0.5.0 requires ruby version >= 3.1.0, which is incompatible with the current version, ruby 2.6.8p0 (jruby 9.3.7.0)
1 parent 389869b commit 42df4f4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/omniauth/strategies/openid_connect.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,12 @@ def access_token
271271
client_auth_method: options.client_auth_method,
272272
}
273273

274+
if configured_response_type == 'code'
275+
token_request_params[:grant_type] = :authorization_code
276+
token_request_params[:code] = authorization_code
277+
token_request_params[:redirect_uri] = redirect_uri
278+
end
279+
274280
token_request_params[:code_verifier] = params['code_verifier'] || session.delete('omniauth.pkce.verifier') if options.pkce
275281

276282
@access_token = client.access_token!(token_request_params)

0 commit comments

Comments
 (0)