0

this is a simple function to create jwt token based on id

 createAccessToken(id: string) {
 const token = sign({ id }, process.env.JWT_SECRET, { expiresIn: '1d' });
 return token;
    }

now when I give the token to https://jwt.io/ without specifing the secretkey the website can still decrypt it

enter image description here

how can this be possible?

Ahmed Sbai
  • 10,695
  • 9
  • 19
  • 38

1 Answers1

1

JWTs are not encrypted, but basically just base64 encoded, cf. RFC 7519. As you can see on https://jwt.io/, you need to provide the secret key if you want to verify the signature.

Manfred
  • 2,269
  • 1
  • 5
  • 14