Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
throw error "No KID specified"
Browse files Browse the repository at this point in the history
  • Loading branch information
denysoblohin-okta committed Dec 14, 2020
1 parent cb38eca commit 1b0d70e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/jwt-verifier/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ class OktaJwtVerifier {
rateLimit: true
});
this.verifier = nJwt.createVerifier().setSigningAlgorithm('RS256').withKeyResolver((kid, cb) => {
this.jwksClient.getSigningKey(kid, (err, key) => {
// If kid is undefined, but there is 1 signing key, `jwks-rsa` will not throw error
if (!kid)
err = new Error(`Error while resolving signing key for kid "${kid}"`);

cb(err, key && (key.publicKey || key.rsaPublicKey));
});
if (kid) {
this.jwksClient.getSigningKey(kid, (err, key) => {
cb(err, key && (key.publicKey || key.rsaPublicKey));
});
} else {
cb("No KID specified", null);
}
});
}

Expand Down

0 comments on commit 1b0d70e

Please sign in to comment.