Skip to content

@types/express-jwt : UnauthorizedError change #22781

Description

@carmas123

If you know how to fix the issue, make a pull request instead.

If you do not mention the authors the issue will be ignored.

The export class UnauthorizedError should be changed:

  • FROM:
    export class UnauthorizedError extends Error  {
          name: string;
          message: string;
          code: string;
          status: number;
          inner: Error
      }
    

- TO:

export type ErrorCode =
    "revoked_token"
    | "invalid_token"
    | "credentials_bad_scheme"
    | "credentials_bad_format"
    | "credentials_required";

export class UnauthorizedError {

    /** 401 */
    status: number;
    message: string;
    name: "UnauthorizedError";
    code: ErrorCode;
    inner: { message: string };

    constructor(code: ErrorCode, error: { message: string });
}

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions