Hi, I have such auth middleware at my node js rest api. When I try make simple GET request by Postman I receive an error - “error”: “Error while resolving signing key for kid “uGvTniLM9U6u1Odb-ZG80vlyYoUOdItjRLextcwiFzo””. Can you advise me how solve it
const OktaVerifier = require(’@okta/jwt-verifier’)
const oktaVerifier = new OktaVerifier({
issuer: process.env.ISSUER,
assertClaims: { aud: ‘api://default’, },
})
module.exports = async (req, res, next) => {
try {
const {authorization} = req.headers
if (!authorization) throw new Error('You must send an Authorization header')
const [authType, token] = authorization.trim().split(' ')
if (authType !== 'Bearer') throw new Error('Expected a Bearer token')
const {claims} = await oktaVerifier.verifyAccessToken(token)
if (!claims.scp.includes(process.env.SCOPE)) {
throw new Error('Could not verify the proper scope')
}
next()
}
catch (err) {
next(err)
}
}