【问题标题】:Need help: AADSTS700016: Application with identifier was not found in the directory Azure Account AD?需要帮助:AADSTS700016:在 Azure 帐户 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.***

【问题讨论】:

    标签: node.js oauth azure-active-directory github-actions


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2019-12-10
      • 1970-01-01
      • 2017-09-08
      • 1970-01-01
      • 2017-04-02
      • 1970-01-01
      • 1970-01-01
      • 2020-02-19
      • 1970-01-01
      相关资源
      最近更新 更多