-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Improve AuthorizationsController error response handling #1676
Improve AuthorizationsController error response handling #1676
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically I like it 👍
Also can you please add a changelog entry? |
# | ||
# This will have no effect if handle_auth_errors is set to :raise. | ||
# | ||
# redirect_on_error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe this should just be configured as handle_auth_errors :redirect
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I went ahead and did this since I think it makes more sense and it cleaner this way 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Hey @nbulaj, any plans for when the next release will be? We'd like to be able to replace our local monkeypatch with this change. Happy to help out in any way to get it released! |
doorkeeper-gem/doorkeeper#1676 updated the `render_error` to return a 400 Bad Request upon an error instead of a 200. Adjust the spec accordingly.
doorkeeper-gem/doorkeeper#1676 updated the `render_error` to return a 400 Bad Request upon an error instead of a 200. Adjust the spec accordingly.
Summary
Hey, first time contributing, hope this is welcome
This PR has three changes to
AuthorizationsController
's error response, explained in more detail below:200
redirectable?
)raise_on_errors?
settingI noticed that Doorkeeper returns a
200
response code when an error occurs, and also does not redirect back to the client on errors as my understanding of the spec indicates it should:https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1
Non-redirecting
Redirecting
There is already the concept of
redirectable?
in Doorkeeper which adheres to this, but it seems like this isn't actually used for errors inauthorizations_controller
.The status code change is applied normally, but I feel like the redirection bit is probably a breaking change since it adds redirects where there wasn't any before, so I added it as a config option via
handle_auth_errors :redirect
Fixes #1643