- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我在使用 passport-azure-ad
库时遇到问题,该库在尝试验证 id_token
时抛出错误。具体的错误信息是“authentication failed due to: In _validateResponse: failed to generate PEM key due to: a key with kid %s cannot be found”
我可以看到 id_token
header 中的 kid
是一个未出现在 key 发现端点(格式为 https://login.microsoftonline.com/{tenantId}/discovery/v2.0/keys
).
为什么会发生这种情况?我无法弄清楚。
我的代码如下:
passport.use(
new OIDCStrategy({
clientID: CLIENT_ID,
clientSecret: CLIENT_SECRET,
identityMetadata: IDENTITY_METADATA_URL,
redirectUrl: SUCCESS_REDIRECT_URI,
responseMode: 'form_post',
responseType: 'code',
scope: 'email profile',
loggingLevel: 'info',
loggingNoPII: false
})
)
app.get(
'/oauthv2/login',
passport.authenticate(
'azuread-openidconnect',
{ failureRedirect: '/fail' },
(req, res) => {
// ...
}
)
)
app.post(
'/oauthv2/success',
passport.authenticate(
'azuread-openidconnect',
{ failureRedirect: '/' },
(req, res) => {
// ...
}
)
)
从 pazzport-azure-ad
日志中,我可以看到在错误发生之前执行了以下步骤:
最佳答案
所以,事实证明我在 Azure Active Directory 中创建了一个 v1 应用程序,虽然这在任何地方都不清楚并且 id_token
说它是 ver: 2.0
但是它不是....
如果您想要在 Azure AD 中使用 v2.0 应用程序,则无法从 Enterprise Applications
部分创建它,您必须使用 App registrations (Preview)
部分。
这解决了我的问题,在我删除我的应用并正确重新创建它后,id_token
包含一个有效的 KID。
希望对遇到同样问题的人有所帮助!
有用的链接:https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app
如果 Azure 的任何人读到这篇文章,请知道在任何部分的标题中添加 (Preview)
意味着我将自动不点击它,因为它看起来并不重要。但是,在这种情况下,这是创建 v2.0 应用程序的唯一方法!
关于javascript - 由于 KID 错误,passport-azure-ad 无法验证 `id_token`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55472766/
已关闭。这个问题是 not reproducible or was caused by typos 。目前不接受答案。 这个问题是由拼写错误或无法再重现的问题引起的。虽然类似的问题可能是 on-top
我将 identityserver4 用于 SSO 问题是每当我重新启动 identityserver 客户端应用程序时第一次获取异常异常消息是 An unhandled exception has
为一张微笑并坐在花园里的 child 的照片写 ALT 文本哪个好? 这 alt="Photo of smiling kid sitting in the garden" 或这个 alt="Photo
我需要帮助来理解如何解决以下问题: Professor Adam has two children who, unfortunately, dislike each other. The proble
我在从 angular js 2 调用端点到 widlfly 服务器时收到此异常“没有找到 child 的 publicKey”。 身份验证发生在 keycloak 中,但是我在同一领域内使用相同的
我正在为我的妻子开发一个联系人管理器作为学习 Silverlight 4 的有趣练习。它将跟踪人们的地址、电话号码、电子邮件、特殊场合(生日、周年纪念等) 在设计数据库的过程中,我遇到了一个小障碍。她
题目地址:https://leetcode-cn.com/problems/kids-with-the-greatest-number-of-candies/ 题目描述 给你一个数组 candie
我生成了一个 JWT 并且有一些我很理解的声明,但是有一个声明叫做 kid在标题中。有谁知道这是什么意思? 我使用 auth0.com 生成了 token 最佳答案 kid是一个可选的 header
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 关闭 9 年前。 Improve
所以我正在为我运行的 Jabber 机器人使用 node-xmpp-client 。我想要做的是获取群聊中用户的实际 JID,而不是别名。所以使用类似这样的代码: client.on('stanza'
我正在尝试使用 SpringBoot 实现 Oauth2 授权服务器 guide作为引用。 我的 keystore 只有一个 key 。我已经成功创建了一个 JWToken(我可以在 jwt.io 上
这是我的 cURL 请求 curl https://geocode.search.hereapi.com/v1/geocode?q=5%20Rue%20Daunou%2C%2075000%20Pari
FundingRank 和 SourceBucket 是枚举,但本质上是 int enum FundingRank { LESS_THAN_0(0), LESS_THAN_1(1),
我想生成一个带有“kid” header 声明的 JWT token 。我有一个 XML 格式的 RSA 私钥来签署 JWT token 。但是在我的 JWT 中,我找不到“kid” header 声
我正在使用 Keycloak 来保护我的 rest api 我在 Keycloak 中有 2 个客户端: -我的前端:React 应用 -我的后端:Spring boot(bearer only ty
我正在尝试使用下面的代码验证有效的 JWT,但遇到一个奇怪的错误 "IDX10501: Signature validation failed. Unable to match key: kid: '
我正在使用带有 openiddict 的 asp.net core,为了授权我正在使用 jwtmiddleware app.UseJwtBearerAuthentication(new JwtBea
我在使用 passport-azure-ad 库时遇到问题,该库在尝试验证 id_token 时抛出错误。具体的错误信息是“authentication failed due to: In _vali
按照文档 here和 there ,我设法设置了一个授权服务器,它发出用非对称 key 签名的 JWT 访问 token ,资源服务器使用公钥的本地副本在本地验证这些 token 。到目前为止一切顺利
我正在尝试验证和解码前端发送的 id token 。 运行验证函数时出现此错误。 有时它可能会起作用。 No pem found for envelope: {"alg":"RS256","kid":
我是一名优秀的程序员,十分优秀!