Skip to content

decode/verify throw up Errors thrown by jws.decode #837

Open

Description

@maricn

Description

Sometimes decode, and in turn - verify, will throw Error instead of JsonWebTokenError. That makes it hard to distinguish errors in the calling code.

Reproduction

var jwt = require("jsonwebtoken")
const malformed_token='notbase64atall';

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

Environment

  • Version of this library used: 8.5.1
  • Version of the platform or framework used, if applicable: https://github.com/auth0/node-jsonwebtoken/
  • Other relevant versions (language, server software, OS, browser): NodeJS v10.20.1 (shouldn't be related)
  • Other modules/plugins/libraries that might be involved: using it from NestJS project

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions