[英]How do you verify a JWT token with a x.509 certificate in node?
I'm trying to make a node script verify a JWT token. 我正在尝试使节点脚本验证JWT令牌。 I have the public key (it's a x.509 certificate) and the JWT.
我有公钥(它是x.509证书)和JWT。
I tried using https://github.com/auth0/node-jsonwebtoken but unfortunately it seems that they don't support x.509. 我尝试使用https://github.com/auth0/node-jsonwebtoken但遗憾的是它们似乎不支持x.509。
If you know of a package that verifies JWT tokens with x.509 certs I would appreciate it. 如果您知道使用x.509证书验证JWT令牌的软件包,我将不胜感激。
Thanks! 谢谢!
JWT can be signed with public/private keys. JWT可以使用公钥/私钥进行签名。 The method you are looking for is this one: https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback
您正在寻找的方法是这样的: https : //github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback
This tests show examples of how to use it: 此测试显示了如何使用它的示例:
https://github.com/auth0/node-jsonwebtoken/blob/master/test/jwt.rs.tests.js https://github.com/auth0/node-jsonwebtoken/blob/master/test/jwt.rs.tests.js
You can also use http://jwt.io 您也可以使用http://jwt.io
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.