Relative Content

Tag Archive for node.jsjwtjose

How to verify token and decode token using ‘jose’ npm

I am having trouble with the ‘jose’ library when it comes to verifying the generated token or JWT of my API. So far the createAccessToken of this is working properly and is generating the token. However in my verifyToken and decodeToken functions, I am getting an error. So far here is the code for my ./middleware/Authentication.js

Invalid JWS is verified

I am using Jose in Node.js to create a JWS signed with a public/private RSA key pair. I am then creating a JWK, which I use to verify that the token is valid. This works well, however I have noticed that if I generate a token with different keys, the JWS is still considered valid.