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
after_encode_and_sign result not used #719
Comments
Would something like this be a good workaround?
|
After a quick search: https://github.com/search?q=after_encode_and_sign+language%3AElixir&type=code&l=Elixir&p=1 They are many people who misuse Based on the contract alone, it is safe to assume they are making a mistake today. But I digress.
The token was already created at this point in the pipeline, so you wouldn't "modify" the token. I do agree with you that it is weird expecting @doomspork do you remember what was your intent here? It feels that it should be |
Steps to Reproduce
I have updated the
after_encode_and_sign
result to conditionally return a different token from the one passed to me. However, this token is not used at all by the code.Expected Result
I expected that by returning
{:ok, different_token}
,Guardian.encode_and_sign
would return{:ok, different_token, claims}
Actual Result
It returns
{:ok, original_token, claims}
.You can see the problem code here. By using the underscore instead of
token
, the value ofafter_encode_and_sign
is ignored except to check success/failure.I could have just made a Pull Request, but I thought perhaps this behavior is what some people actually want? At a minimum I would expect it to look for
:ok
instead of a tuple since that implies you use the result.The text was updated successfully, but these errors were encountered: