How to use node-jose with jwt token?

901 Views Asked by At

I using jsonwebtoken to get the token using sign method.

I want to encrypt the payload inside the token. so I do it by using node-jose.

createEncrypt give me a token. so now I need to call sign method and pass the token (from createEncrypt) to the payload like this?

var token = await JWE.createEncrypt(options, key)
    .update(payload, "utf8")
    .final();

const tokenJwt = jsonwebtoken.sign({ token }, 'secret', ..);

or this is my token now (from createEncrypt), and I just need to verify using node-jose without using jsonwebtoken?

Accoring to jwt.io, the token from createEncrypt is not valid (Invalid Signature)

enter image description here

0

There are 0 best solutions below