如何验证Line-api的id令牌? (如何以与java相同的方式使用jwt.net?)

时间:2018-05-22 09:51:36

标签: c# .net jwt

如何验证id_token使用JWT.Net? 这是java中的代码:

            JWT.require(
            Algorithm.HMAC256(channelSecret))
            .withIssuer("https://access.line.me")
            .withAudience(channelId)
            .withClaim("nonce", nonce)
            .build()
            .verify(id_token);

https://developers.line.me/en/docs/line-login/web/integrate-line-login/的详细信息 请参阅部分:Decoding and validating ID tokens

如何在C#.Net中创建相同的功能? 有关于nuget的JWT.Net没有找到类似的方法。

1 个答案:

答案 0 :(得分:0)

我现在找到了如何使用JWT.Net。

                decodedJson = new JwtBuilder()
                .WithSecret(secret)
                .WithAlgorithm(hmacsha256Algorithm)
                .MustVerifySignature()
                .Decode(idToken);