JwtSecurityToken understanding and exception

前端 未结 2 1250
既然无缘
既然无缘 2020-12-18 23:40

I\'m fairly new to JwtSecurityTokens, and I try to understand the different aspects of it and furhtermore the whole claimsidentity and claimp

相关标签:
2条回答
  • 2020-12-19 00:29

    The algorithm HS256 requires the SecurityKey.KeySize to be greater than 128 bits and your key has just 48. Extend it by adding at least 10 more symbols. As for "PII is hidden" part, it was done as a part of GDPR compliance effort to hide any stack or variable info in logs. You should enable additional details with:

    IdentityModelEventSource.ShowPII = true;
    
    0 讨论(0)
  • 2020-12-19 00:35

    You should add enough characters for you secret key. when you set your secret key here,

    //your SECRET_KEY = "abcdef"
    new SymmetricSecurityKey(Encoding.UTF8.GetBytes(SECRET_KEY));
    

    change it to

    new SymmetricSecurityKey(Encoding.UTF8.GetBytes("somethingyouwantwhichissecurewillworkk"));
    

    this should work.

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