Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[auth/jwt] error handling #923

Closed
sagikazarmark opened this issue Oct 16, 2019 · 0 comments
Closed

[auth/jwt] error handling #923

sagikazarmark opened this issue Oct 16, 2019 · 0 comments

Comments

@sagikazarmark
Copy link
Contributor

Asked this question on Slack some time ago:

How do you all use the JWT middleware to return proper status codes to the user?

I don't want JWT errors to show up in the server error logs (since they are client errors), so for now I added another endpoint middleware in front of it which converts returned errors to endpoint.Failer instances and returns them as endpoint responses instead of errors.

This also means that I can't use the ServerErrorEncoder to encode these errors. Error encoding is now part of the response encoding, which is also not ideal (I have to add error encoding to all response encoders).

One alternative solution I see is implementing some sort of "filtering" in the ServerErrorHandler to skip client (4xx) errors, like invalid token errors.

I would love to hear other opinions. I also noticed that while the basic auth returns a common error type, jwt auth does not. Is that on purpose?

I just wanted to open an issue for it so that it can serve as a base for future discussions about error handling in go-kit.

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

2 participants