You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
https://github.com/plangrid/flask-rebar/blob/master/flask_rebar/rebar.py#L123-L131
If an app uses multiple authenticators, we use a "first past the post" approach - authenticators will do their thing until one succeeds. If NONE of them succeed, the error message returned is always the first error encountered. This can make debugging tricky if:
you have two (or more) authenticators
they both fail
you want to know why the SECOND one failed.
Maybe instead of just returning the message from the first authenticator we should collect all failure messages and return those in the body of the error response (if we wanted to make it backwards-compatible we could perhaps augment the response json from e.g. { "message": "No auth token provided." }
to e.g., { "message": "No auth token provided.", "additional_messages": ["Nope!", "authenticator3 barfed too!"] }
The text was updated successfully, but these errors were encountered:
Hey @RookieRick , I ended up here cause I was strolling through the Flask discord channel. I am a completely newbie, so this might be a dumb question but I was wondering if this ticket has any relation to #79 ??
@akibrhast No such thing as a dumb question in my book :D Been a while since I looked at that other one but skimming to refresh I think this one is distinct in that it's more about how our authenticators approach behaves whereas #79 is more general error handling (typically around malformed input/output)
Love the idea of providing the errors under a different key; wish I'd thought of that 😄
On a separate note: the main message should really just be a generic "Unauthorized" message, might be a change to roll into 2.0 since it breaks backward compatibility for anything that parses the message.
OK, tagging this one as 2.1 because we can do it without breaking change following Andrew's suggestion of putting generic "Unauthorized" in message and adding "additional_messages" or "authenticator_results" or some-such as a bolt-on that doesn't break backward compat.
(And if returning generic "Unauthorized" in message breaks anything because people are parsing a human-readable message, to drive logic.. well... let them eat cake 🙈 )
https://github.com/plangrid/flask-rebar/blob/master/flask_rebar/rebar.py#L123-L131
If an app uses multiple authenticators, we use a "first past the post" approach - authenticators will do their thing until one succeeds. If NONE of them succeed, the error message returned is always the first error encountered. This can make debugging tricky if:
Maybe instead of just returning the message from the first authenticator we should collect all failure messages and return those in the body of the error response (if we wanted to make it backwards-compatible we could perhaps augment the response json from e.g.
{ "message": "No auth token provided." }
to e.g.,
{ "message": "No auth token provided.", "additional_messages": ["Nope!", "authenticator3 barfed too!"] }
The text was updated successfully, but these errors were encountered: