Skip to content

SyntaxError instead of JsonWebTokenError #652

Open
@sm2017

Description

@sm2017

Description

Sometime verify throws SyntaxError instread of JsonWebTokenError

Reproduction

var jwt = require("jsonwebtoken")
const malformed_token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';

jwt.verify(
        malformed_token,
        'Secret',
        {
          algorithms: [ 'HS256' ],
        }
      );

Environment

Version of this library used: 8.5.1

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