Quantcast
Channel: Claims based access platform (CBA), code-named Geneva forum
Viewing all articles
Browse latest Browse all 2535

JwtSecurityToken exception while decoding Azure Mobile Services JWT token

$
0
0

The following code:

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

Generates the following exception:

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

When the 'header' section of the rawToken is:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6MH0

Which can be decoded to:

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

The source of the faulting token is Azure Mobile Services.

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

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjAifQ

Which can be decoded to:

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

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


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>