Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Doorkeeper 5.2 compatibility #83

Closed

Conversation

nbudin
Copy link

@nbudin nbudin commented Sep 16, 2019

Doorkeeper 5.2.0 seems to have changed the method signature for OAuth::PreAuthorization#initialize. It previously took a client as a parameter, but now expects a :client_id key in attrs instead. (This probably should have been considered a breaking change but doesn't seem to have been.)

Because of that, trying to log in when the server is using this gem with doorkeeper 5.2.0 gives a traceback ending in:

doorkeeper-openid_connect (1.6.2) lib/doorkeeper/openid_connect/oauth/pre_authorization.rb:8:in `initialize'
doorkeeper (5.2.0) lib/doorkeeper/oauth/pre_authorization.rb:20:in `initialize'
ArgumentError processing GraphQL query: wrong number of arguments (given 3, expected 1..2)

This patch attempts to fix it while still maintaining compatibility with older Doorkeeper releases. To do that, it checks both the type of the client parameter and whether or not the super initializer has a parameter called client. It's a little complicated but it seems to work.

@toupeira
Copy link
Member

@nbudin thanks for the report! 👍

Technically we're trespassing on internal Doorkeeper APIs, so I'm not sure if it can really be considered a "breaking change" 😛

But I stumbled across some other breakage with Doorkeeper 5.2, so I think I'll just require that as a minimum for doorkeeper-openid_connect 1.7.0 (or 2.0.0? 🤔) and started #85 to get Doorkeeper 5.2 running, and also possibly Rails 6.

In the meantime I also released 1.6.3 which specifically requires Doorkeeper < 5.2.

Let me know if that works for you! I'll close this PR.

@toupeira toupeira closed this Sep 24, 2019
@nbudin
Copy link
Author

nbudin commented Sep 24, 2019

@toupeira That seems reasonable, thanks! I'm currently using my fork on the one project that needs it, and I can keep doing so until you release the next version.

@nbulaj
Copy link
Member

nbulaj commented Oct 10, 2019

Hi @toupeira . Sorry for the closed issue, but it the main topic here

Technically we're trespassing on internal Doorkeeper APIs, so I'm not sure if it can really be considered a "breaking change"

I'm open for the suggestions on how we can make the API open for doorkeeper-openid_connect to simplify your (and everyone else) life. If you have some ideas - you can propose a PR for main project and we'll continue here.

I'm thinking about a plugin system for Doorkeeper for a long time, and it must simplify creating of integrations and extensions for the gem. A have PoC, but let's first start with the above. Thanks!

@toupeira
Copy link
Member

@nbulaj thanks for reaching out! That definitely sounds nice, but to be honest I barely have the time to maintain this gem as it is 😿

I opened an issue now at #89 to find new maintainers.

@toupeira
Copy link
Member

@nbudin if you could give the PR at #88 a spin in your app, that would be very much appreciated!

@nbudin
Copy link
Author

nbudin commented Oct 13, 2019

@toupeira It works for me!

@toupeira
Copy link
Member

toupeira commented Nov 4, 2019

@nbudin @Ex-Ark thanks for testing! 🙏

The changes for Doorkeeper 5.2 are now merged and released as version 1.7.0 of this gem.

@toupeira toupeira added the bug label Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants