JWT hs512 signature slightly different from jwt.io if calculated with python

后端 未结 1 463
太阳男子
太阳男子 2021-01-26 16:36

So I get different signatures for the same JWT.

Header:

{
  "alg": "HS512",
  &         


        
相关标签:
1条回答
  • 2021-01-26 17:06

    In your Python code you used Base64 encoding, but the JWT standard requires Base64URL encoding. The differences are that the characters "+" and "/" in Base64 encoding are replaced with "-" and "_" and that padding is omitted.

    It might or might not work, depending on the receiving sides Base64URL decoder implementation. To be on the safe side, I recommend to follow the standard.

    0 讨论(0)
提交回复
热议问题