Specify auth_scheme: :request_body
for oauth2 v2.x compatibility
#26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The oauth2 gem switched the default auth_scheme in v2 from
:request_body
to:basic_auth
. This caused an "Invalid Credentials" error when requesting the auth token because client_id and client_secret params were not included in the requests.This is a backwards compatible change that will work with oauth2 v1.x and v2.x.
https://gitlab.com/oauth-xx/oauth2/-/blob/v1.4.11/lib/oauth2/client.rb?ref_type=tags#L44
https://gitlab.com/oauth-xx/oauth2/-/blob/v2.0.0/lib/oauth2/client.rb?ref_type=tags#L46
For anyone curious, the
auth_scheme
determines how the authentication params or headers are included in the token request. Since this is nowbasic_auth
unless specified, theclient_id
andclient_secret
were not included in params. https://gitlab.com/oauth-xx/oauth2/-/blob/v2.0.9/lib/oauth2/authenticator.rb?ref_type=tags#L24Fixes #25