Closed tpluscode closed 2 years ago
import { expressjwt as jwt } from 'express-jwt'
import jwksRsa from 'jwks-rsa'
const authorize = jwt({
// Dynamically provide a signing key
// based on the kid in the header and
// the signing keys provided by the JWKS endpoint.
secret: jwksRsa.expressJwtSecret({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 5,
jwksUri,
}) as GetVerificationKey,
})
Source: https://github.com/auth0/express-jwt/issues/288#issuecomment-1122524366
Yep, thanks for posting the workaround. Not much we can do in this SDK about https://github.com/auth0/express-jwt/issues/288#issuecomment-1122524366
At a minimum, the express-demo README should be updated to point out the as GetVerificationKey
workaround for typescript users.
Describe the problem
Typescript does not like the return type of
jwksRsa.expressJwtSecret
. I get this error when relying on TS to resolve the typesWhat was the expected behavior?
No type errors
Reproduction
This can be mitigated by explicitly typing
as GetVerificationKey
Environment