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
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 always CaseClauseError{term: {:error, :badarg}}}
I think this is because the root error is returned by decode_token, then returning_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 generic CaseClauseError.
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:
@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: