<tfoot id='ghJJK'></tfoot>

<small id='ghJJK'></small><noframes id='ghJJK'>

      <legend id='ghJJK'><style id='ghJJK'><dir id='ghJJK'><q id='ghJJK'></q></dir></style></legend>

      1. <i id='ghJJK'><tr id='ghJJK'><dt id='ghJJK'><q id='ghJJK'><span id='ghJJK'><b id='ghJJK'><form id='ghJJK'><ins id='ghJJK'></ins><ul id='ghJJK'></ul><sub id='ghJJK'></sub></form><legend id='ghJJK'></legend><bdo id='ghJJK'><pre id='ghJJK'><center id='ghJJK'></center></pre></bdo></b><th id='ghJJK'></th></span></q></dt></tr></i><div id='ghJJK'><tfoot id='ghJJK'></tfoot><dl id='ghJJK'><fieldset id='ghJJK'></fieldset></dl></div>

        • <bdo id='ghJJK'></bdo><ul id='ghJJK'></ul>

        解码 Azure 移动服务 JWT 令牌时出现 JwtSecurityToke

        时间:2023-06-01
            <tbody id='prosf'></tbody>
        • <i id='prosf'><tr id='prosf'><dt id='prosf'><q id='prosf'><span id='prosf'><b id='prosf'><form id='prosf'><ins id='prosf'></ins><ul id='prosf'></ul><sub id='prosf'></sub></form><legend id='prosf'></legend><bdo id='prosf'><pre id='prosf'><center id='prosf'></center></pre></bdo></b><th id='prosf'></th></span></q></dt></tr></i><div id='prosf'><tfoot id='prosf'></tfoot><dl id='prosf'><fieldset id='prosf'></fieldset></dl></div>

            <legend id='prosf'><style id='prosf'><dir id='prosf'><q id='prosf'></q></dir></style></legend>
                <bdo id='prosf'></bdo><ul id='prosf'></ul>
                  <tfoot id='prosf'></tfoot>

                  <small id='prosf'></small><noframes id='prosf'>

                1. 本文介绍了解码 Azure 移动服务 JWT 令牌时出现 JwtSecurityToken 异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  以下代码:

                  using System.IdentityModel.Tokens;
                  
                  JwtSecurityToken jwtSecurityToken = new JwtSecurityToken(rawToken);
                  

                  产生以下异常:

                  Jwt10113: Unable to decode the 'header'
                  The value "0" is not of type "System.String" and cannot be used in this generic collection. Parameter name: value
                  

                  当 rawToken 的 'header' 部分是:

                  When the 'header' section of the rawToken is:

                  eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6MH0
                  

                  可以解码为:

                  {"alg":"HS256","typ":"JWT","kid":0}
                  

                  错误令牌的来源是 Azure 移动服务.

                  The source of the faulting token is Azure Mobile Services.

                  请注意,当'header'部分是:调用同一行代码时不会发生异常:

                  Please note that the exception does not occur when calling the same line of code while the 'header' section is:

                  eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjAifQ
                  

                  可以解码为:

                  {"alg":"HS256","typ":"JWT","kid":"0"}
                  

                  我怎样才能克服这个问题,并正确验证这样的令牌?

                  How can I overcome this problem, and properly validate such a token?

                  推荐答案

                  这是 Azure 移动服务中的一个错误,它与 JWT 规范的一致性有关.该错误已得到修复,因此移动服务生成的 JWT 现在应该在其标头的kid"字段中具有正确的字符串值.

                  This was a bug in the Azure Mobile Services with respect to its conformance with the JWT spec. The bug has since been fixed, so the JWTs generated by the mobile services should now have a correct string value in the "kid" field of its header.

                  这篇关于解码 Azure 移动服务 JWT 令牌时出现 JwtSecurityToken 异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:ASP.NET Core 5.0 JWT 身份验证总是抛出 HTTP 401 代码 下一篇:验证 JWT Token c# 的签名

                  相关文章

                  最新文章

                  <small id='oRLB4'></small><noframes id='oRLB4'>

                  <tfoot id='oRLB4'></tfoot>

                  <i id='oRLB4'><tr id='oRLB4'><dt id='oRLB4'><q id='oRLB4'><span id='oRLB4'><b id='oRLB4'><form id='oRLB4'><ins id='oRLB4'></ins><ul id='oRLB4'></ul><sub id='oRLB4'></sub></form><legend id='oRLB4'></legend><bdo id='oRLB4'><pre id='oRLB4'><center id='oRLB4'></center></pre></bdo></b><th id='oRLB4'></th></span></q></dt></tr></i><div id='oRLB4'><tfoot id='oRLB4'></tfoot><dl id='oRLB4'><fieldset id='oRLB4'></fieldset></dl></div>

                      <bdo id='oRLB4'></bdo><ul id='oRLB4'></ul>
                    <legend id='oRLB4'><style id='oRLB4'><dir id='oRLB4'><q id='oRLB4'></q></dir></style></legend>