express-jwt icon indicating copy to clipboard operation
express-jwt copied to clipboard

[Feature Request] Please document error codes

Open lonix1 opened this issue 6 years ago • 2 comments

Would be very helpful for the docs to clearly document the various types of error codes.

I had all sorts of problems because I didn't know which errors were coming from this library, and what they meant.

I went through the code and found these:

  • 'credentials_bad_scheme'
  • 'credentials_bad_format'
  • 'credentials_required'
  • 'invalid_token' x2
  • 'revoked_token'

Note that the 'invalid_token' error code is used in two cases: 1) because of a failed decode and 2) because of a failed verify. There should be a distinction between them, but that is a separate issue (perhaps we should use different codes, or different messages).

lonix1 avatar Feb 11 '19 12:02 lonix1

+1 to this. In order to provide proper logging and feedback related these errors, it would be great to know what to expect.

I also went through the source, and it looks like those are the full collection of errors for this library. Since it uses node-jsonwebtoken under the hood, here are some additional codes: https://github.com/auth0/node-jsonwebtoken#errors--codes

krumware avatar Jun 20 '19 19:06 krumware

Test comment.

gannear avatar Sep 07 '20 11:09 gannear