Skip to content

[Feacture Request] Support creating JwtVerifier for issuer null #178

Closed
@ottokruse

Description

@ottokruse

Describe the bug
The JwtRsaVerifier throws an error for JWTs that have no iss field: error: Missing Issuer. Expected: null

But iss is an optional field. And in this case I am creating the verifier like so, setting issuer to null to signal that I don't want to check it:

const verifier = JwtRsaVerifier.create({
  issuer: null,
  audience: null,
  jwksUri: "<my uri>",
  customJwtCheck: ({ payload }) => {
    // my implementation
  },
});

It looks like the error is, that the JWK caching mechanism is based on iss (makes sense in principle) but cannot handle missing iss:

decomposedJwt.payload.iss,

Versions
Which version of aws-jwt-verify are you using? 4.0.1
Are you using the library in Node.js or in the Web browser? Node.js
If Node.js, which version of Node.js are you using? (Should be at least 16) 20
If Web browser, which web browser and which version of it are you using? N/A
If using TypeScript, which version of TypeScript are you using? (Should be at least 4) High enough

To Reproduce
If you can, please provide a minimal code example that reproduces the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions