Skip to content

Malformed token cause verify method to return SyntaxError #591

Open
@Digitum

Description

@Digitum

To recreate:
Create a token with malformed payload ( i e add some random letters in payload part).
Run token throught verify() method.
Error object now is of type "SyntaxError" with message "Unexpected end of JSON input".

Expected result:
Error object of name "JsonWebTokenError" with message "jwt malformed"

Actual result:
Error object of name "SyntaxError" with message "Unexpected end of JSON input"

Proposed actions:

  • Use message "jwt malformed" on "JsonWebTokenError" when JSON is malformed.
  • Add new Error type "SyntaxError" with corresponding message on errors thrown on other reasons not included in documentation expected error message list.
    image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions