If you can decode JWT, how are they secure?

后端 未结 7 1139
遥遥无期
遥遥无期 2020-11-22 10:49

If I get a JWT and I can decode the payload, how is that secure? Couldn\'t I just grab the token out of the header, decode and change the user information in the payload, an

7条回答
  •  失恋的感觉
    2020-11-22 11:39

    Only JWT's privateKey, which is on your server will decrypt the encrypted JWT. Those who know the privateKey will be able to decrypt the encrypted JWT.

    Hide the privateKey in a secure location in your server and never tell anyone the privateKey.

提交回复
热议问题