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

Token expire and invalid token both case same error message and status code #260

Open
mahendraVaghani opened this issue Jan 24, 2018 · 1 comment

Comments

@mahendraVaghani
Copy link

Jwt token expire and Invalid credential both case error meassage same
so, how i can differentiate token expire or invalid
verify token for jsonweb token he give error for expire token either invalide token
Problem:
return reply(raiseError('unauthorized',
'Invalid token', tokenType), null, { credentials: null });

verify token for jsonweb token he give error for expire token either invalide token
solution:
if (verify_err.name == "TokenExpiredError") {
return reply(raiseError(verify_err.name,
verify_err.message, verify_err.expiredAt, verify_err.payload), null, {credentials: null}).code(440);
} else {
return reply(raiseError(verify_err.name,
verify_err.message, verify_err.expiredAt, verify_err.payload), null, {credentials: null}).code(498);
}

@jamesdixon
Copy link

@mahendraVaghani I just ran into this as well. Was seeing a ton of "invalid token" errors, but had no idea what that actually meant.

Definitely need to adjust the code to return the actual error. I plan on submitting a PR sometime this week if no one gets to it beforehand.

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

No branches or pull requests

2 participants