【发布时间】:2018-01-01 04:44:43
【问题描述】:
我在使用 jwt.io 验证我的 azure 广告访问令牌时收到无效签名。但是,我的 id 令牌验证得很好!
我已经看到并尝试了
Invalid signature while validating Azure ad access token
中建议的解决方案
和
https://nicksnettravels.builttoroam.com/post/2017/01/24/Verifying-Azure-Active-Directory-JWT-Tokens.aspx
但两者都不适用于我的访问令牌。
访问和 Id 令牌是通过 Adal.js 生成的:
var endpoints = {
"https://graph.windows.net": "https://graph.windows.net"
};
var configOptions = {
tenant: "<ad>.onmicrosoft.com", // Optional by default, it sends common
clientId: "<app ID from azure portal>",
postLogoutRedirectUri: window.location.origin,
endpoints: endpoints,
}
window.authContext = new AuthenticationContext(configOptions);
为什么我可以验证我的 ID 令牌,但不能验证我的访问令牌?
【问题讨论】:
-
访问令牌是用句号(.)分隔的三部分吗?
-
请解码访问令牌,您在 HEADER 中看到过 nonce 吗?
-
@RasmusW 两个令牌的格式都正确,我对每个令牌中的信息进行解码都没有问题。只有验证是个问题。
-
@NanYu 是的,随机数在标题中。 typ、alg、x5t 和 Kid 也是如此
-
看我的回复,nonce导致验证失败。
标签: validation oauth-2.0 azure-active-directory access-token adal