You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

JWT令牌验证报错:缺失'alg'字段,签名验证失败(System.IdentityModel.Tokens.Jwt)

使用System.IdentityModel.Tokens.Jwt验证JWT令牌时验证失败问题

我在使用System.IdentityModel.Tokens.Jwt验证JWT令牌时,发现令牌未返回alg字段,导致令牌始终验证失败。抛出的异常信息如下:

IDX10503: Signature validation failed. Token does not have a kid. Keys tried: 'Microsoft.IdentityModel.Tokens.RsaSecurityKey, KeyId: '', InternalId: 'Y-aoLdlxdepu_g1odJVOn_g-FlaitSghcGfrV1vSuxg'. , KeyId: 
    '. Number of keys in TokenValidationParameters: '0'. 
    Number of keys in Configuration: '0'. 
    Exceptions caught:
     'Microsoft.IdentityModel.Tokens.SecurityTokenInvalidAlgorithmException: IDX10696: The algorithm 'Null' is not in the user-defined accepted list of algorithms.

相关截图:

内容的提问来源于stack exchange,提问作者shaair

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 15:14:51