diff --git a/CHANGELOG.md b/CHANGELOG.md index 59e1c77..2d66569 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Unreleased +- [#153] Fix ArgumentError caused by client credential validation introduced in Doorkeeper 5.5.1 + ## v1.8.0 (2021-05-11) No changes from v1.8.0-rc1. diff --git a/lib/doorkeeper/openid_connect/oauth/password_access_token_request.rb b/lib/doorkeeper/openid_connect/oauth/password_access_token_request.rb index 15d1737..9e00f63 100644 --- a/lib/doorkeeper/openid_connect/oauth/password_access_token_request.rb +++ b/lib/doorkeeper/openid_connect/oauth/password_access_token_request.rb @@ -6,9 +6,16 @@ module OAuth module PasswordAccessTokenRequest attr_reader :nonce - def initialize(server, client, resource_owner, parameters = {}) - super - @nonce = parameters[:nonce] + if Gem.loaded_specs['doorkeeper'].version >= Gem::Version.create('5.5.1') + def initialize(server, client, credentials, resource_owner, parameters = {}) + super + @nonce = parameters[:nonce] + end + else + def initialize(server, client, resource_owner, parameters = {}) + super + @nonce = parameters[:nonce] + end end private diff --git a/spec/lib/oauth/password_access_token_request_spec.rb b/spec/lib/oauth/password_access_token_request_spec.rb index 50c3059..2c235e7 100644 --- a/spec/lib/oauth/password_access_token_request_spec.rb +++ b/spec/lib/oauth/password_access_token_request_spec.rb @@ -3,10 +3,15 @@ require 'rails_helper' describe Doorkeeper::OpenidConnect::OAuth::PasswordAccessTokenRequest do - subject { Doorkeeper::OAuth::PasswordAccessTokenRequest.new server, client, resource_owner, { nonce: '123456' } } + if Gem.loaded_specs['doorkeeper'].version >= Gem::Version.create('5.5.1') + subject { Doorkeeper::OAuth::PasswordAccessTokenRequest.new server, client, credentials, resource_owner, { nonce: '123456' } } + else + subject { Doorkeeper::OAuth::PasswordAccessTokenRequest.new server, client, resource_owner, { nonce: '123456' } } + end let(:server) { double } let(:client) { double } + let(:credentials) { } let(:resource_owner) { create :user } let(:token) { create :access_token } let(:response) { Doorkeeper::OAuth::TokenResponse.new token }