Relative Content

Tag Archive for node.jsjwejose

How to use the jose package to verify an encrypted JWT

I’m trying to figure out how to use the jose package to decrypt and verify a JWT using JWE. I’ve tried to pass the encrypted JWT to the verify method like: await jose.jwtVerify(encryptedJWT, keys); but that returns JWSInvalid: Invalid Compact JWS. I then tried to decrypt the JWT, but then I can’t find the method/methods to use to verify just the header portion of the decrypted JWT. All of the verify methods seem to expect a non encrypted full JWT to function. Code is as follows: