An example verifying a JWT issued at a server in a browser
$ openssl genrsa -out jwk.pem 4096
$ openssl rsa -in jwk.pem -RSAPublicKey_out -out jwk-public.pem
$ npm install jsonwebtoken rasha
$ node issue.js jwk.pem '{"foo":"bar"}'
$ node pem2jwk.js jwk-public.pem
importing verify-in-browser.js
const jwkCertKey = {
"kty": "RSA",
"n": "xxxxxxxxxxxx",
"e": "AQAB"
};
const jwt = 'xxxxxxxxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxx';
await verifyJWT(jwt, jwkCertKey);
{ "foo":"bar", iat: 1602000000, exp: 1613000000 }