需要帮助:AADSTS700016:在 Azure 帐户 AD 目录中找不到具有标识符的应用程序?

Posted

技术标签:

【中文标题】需要帮助:AADSTS700016:在 Azure 帐户 AD 目录中找不到具有标识符的应用程序?【英文标题】:Need help: AADSTS700016: Application with identifier was not found in the directory Azure Account AD? 【发布时间】:2021-12-26 05:36:05 【问题描述】:

当我在 Azure 上的 VM 上运行我的 node.js 应用程序时,我对 Azure AD Oauth2 令牌的请求工作正常。它使用另一个团队的客户端 id/secret 发出请求,因为在代码的更下方,程序将使用该令牌对他们的服务进行 REST API 调用。如果我的程序(node.js 应用程序)是从 Github 工作流启动的,则程序在获取/请求令牌后会出错。 (工作流程成功运行了 3 次才出现此错误。现在每次都出现此错误。)感谢您的帮助!非常感谢,我在这方面没有太多经验。

async function getToken(config) 
  const params = new URLSearchParams()
  params.append('grant_type', 'client_credentials')
  params.append('client_id', config.clientId)
  params.append('client_secret', config.clientSecret)
  params.append('scope', config.scopeUrl)

  //url = https://login.microsoftonline.com/AD.tenantId/oauth2/v2.0/token

  const response = await fetch(config.tokenRequestUrl,  method: 'POST', body: params )
  const jsonObj = await response.json()

  console.log('!!!!JSON='+JSON.stringify(jsonObj))

  if ((typeof jsonObj.access_token !== 'undefined') && (jsonObj.access_token != null)) 
    return jsonObj.access_token
   else 
    return null
  

输出:

!!!!3S0N=***"error":"unauthorizedclient","errordescription":"AADSTS700016: Application with identifier '***' was not found in the directory 'xxxxx Azure Account AD'. This can happen if the application has
not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.***

【问题讨论】:

【参考方案1】:

我想通了! Github 工作流使用了错误的客户端 ID/密码。

【讨论】:

以上是关于需要帮助:AADSTS700016:在 Azure 帐户 AD 目录中找不到具有标识符的应用程序?的主要内容,如果未能解决你的问题,请参考以下文章

登录 Azure Web 应用程序失败并显示“AADSTS50079:用户需要使用多重身份验证”

Azure AD:收到AADSTS50011错误

无法访问 Azure 上的 OpenId UserInfo 端点(AADSTS90010:JWT 令牌不能与 UserInfo 端点一起使用)

试图让Azure中美国州长的授权代码时出错:获得“无效的资源AADSTS650057”

“AADSTS5002730:无效的 JWT 令牌。 Azure Signal R 服务令牌的代表方案中出现“签名算法的密钥不受支持”错误

AADSTS50012:从测试应用程序移动到生产环境时提供了无效的客户端密码