This pacakge was created, because the current JWKS clients available only work in node, but not in the browser. This client is specifically designed to work in the browser. Given a JWKS endpoint URL and a kid
it will retrieve the public key that you can use for JWT verification.
Installation
npm i jwks-client-browser
or
yarn add jwks-client-browser
Usage
JavaScript
; const kid = JSONkid const jwksClient = url: '[your_jwks_endpoint]' ; const signingKey = jwksClient;
TypeScript
; ; ;
Once you acquired the public key, you can use it to verify the token. Here's an example using the jsonwebtoken
package:
; ; jwt.verifytoken, signingKey.publicKey;
Disclaimer
This is still a draft version of the package. Contributions are welcome!