Skip to content
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

Authorization: Not Found when token is for different email #902

Open
lautarodragan opened this issue Apr 10, 2019 · 1 comment
Open

Authorization: Not Found when token is for different email #902

lautarodragan opened this issue Apr 10, 2019 · 1 comment
Labels
dx Developer Experience

Comments

@lautarodragan
Copy link
Member

lautarodragan commented Apr 10, 2019

The authorization middleware sets the status to 404 if doesn't find the user associated with the token.

const usersController = new AccountsController(ctx.logger, verifiedAccount, pwnedCheckerRoot)
ctx.state.tokenData = tokenData
ctx.state.user = await usersController.get(email)
ctx.state.jwtSecret = jwt
return ctx.state.user ? next() : (ctx.status = 404)

This can happen when the user changes their email address — tokens created before the change will remain associated to the previous address.

In this case, a simple Not Found error message provides little to no guidance.

Replace with Invalid Token, which is more correct, and logger.warning details of the event.

@lautarodragan
Copy link
Member Author

lautarodragan commented Jun 11, 2019

Will be mitigated by #916

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dx Developer Experience
Projects
None yet
Development

No branches or pull requests

1 participant