-
Notifications
You must be signed in to change notification settings - Fork 380
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
Opaque errors when token verification fails #711
Comments
Hello, @rawnsley! |
@f-francine A log message would be great - thank you. |
@f-francine thank you so much for the help. @rawnsley do you mind filling up the "Solution Brainstorm" I am not sure what you are asking us to do or what you would propose. Or even much better, since you already know how to replicate the issue and whatnot, create a PR with the proposed solution. I am here to help you with it as much as I can. |
Problem Statement
Caveat: I am new to both Guardian and Elixir
While trying to get the
decode_and_verify
function working, I was thwarted by obscure error messages. In the end my problem was fixed by being explicit about the allowed algorithms, but the error returned by this function was alwaysCaseClauseError{term: {:error, :badarg}}}
I think this is because the root error is returned by
decode_token
, thenreturning_tuple
maps it to{ :error, _ }
(already striping out any useful info), and then the calling function has no matching case clause anyway so it throws a genericCaseClauseError
.This exception is caught in
decode_and_verify
and an error message is returned, but there is no chance of debugging where the failure originally occured.I'm not sure what the right behaviour should be in this case or what is canonical Elixir, but as it stands I ended up having to reproduce the call chain line-by-line in my client code until I found the problem, which isn't ideal.
Solution Brainstorm
No response
The text was updated successfully, but these errors were encountered: