javascript - 错误: AADSTS500011: The resource principal named "URL" was not found in the tenant

标签 javascript typescript azure azure-active-directory sharepoint-online

我正在尝试使用 https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part 中的模板将应用程序添加到我们的 SharePoint Online 网站。当我们部署到 SharePoint 并将应用程序/Web 部件添加到测试 SharePoint 网站时,我们会收到以下错误。我们使用 TypeScript 作为模板使用。

还有其他人遇到过此问题或知道在哪里查找问题吗?

找到 [object 对象]驱动程序显示外部错误:错误:AADSTS500011:名为 https://driverdisplayexternal.azurewebsites.net 的资源主体在名为 7018324c-9efd-4880-809d-b2e6bb1606b6 的租户中未找到。如果应用程序尚未由租户管理员安装或未得到租户中任何用户的同意,则可能会发生这种情况。您可能已将身份验证请求发送给了错误的租户。跟踪 ID:358b22eb-cd2c-4091-b592-5a57cbc21d00 相关 ID:ec96d656-1a36-42e2-a2b9-3ff78efc1e2e 时间戳:2019-10-01 16:26:06Z

我们已经添加了对我们自己的客户端的调用,如下所示。我们不确定为什么找不到资源主体。租户 ID 匹配,并且似乎已正确设置身份验证。

HelloWorldWebPart.ts

...
   this.context.aadHttpClientFactory
      .getClient('https://driverdisplayexternal.azurewebsites.net')
      .then((client: AadHttpClient): void => {

        client
          .get('https://driverdisplayexternal.azurewebsites.net/api/values', AadHttpClient.configurations.v1)
          .then((response: HttpClientResponse): Promise < Order[] > => {
            this.domElement.innerHTML += 'Received a response from Driver Display External: ' + response;
            return response.json();
          })

          .catch(error => {

            this.domElement.innerHTML += 'Driver Display External Error:  ' + error;
            console.error(error);
          });
      });
...

package-solution.json

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
  "solution": {
    "name": "helloworld-webpart-client-side-solution",
    "id": "**ID**",
    "version": "4.1.0.0",
    "includeClientSideAssets": true,
    "isDomainIsolated": false,
    "webApiPermissionRequests": [
      {
        "resource": "DriverDisplayExternal",
       "scope": "User.Read.All"
      }
     ]
  },
  "paths": {
    "zippedPackage": "solution/helloworld-webpart.sppkg"
  }
}

任何有关问题所在的帮助或指导将不胜感激。提前致谢!

最佳答案

从未使用过此 API,但如果我不得不猜测您需要更改此处的值:

      .getClient('https://driverdisplayexternal.azurewebsites.net')

您可以使用客户端 ID/应用程序 ID 或应用程序 ID URI。

关于javascript - 错误: AADSTS500011: The resource principal named "URL" was not found in the tenant,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58192789/

相关文章:

javascript - 表单已发送但验证有错误

javascript - 被动网络切换后如何重新连接套接字

javascript - 三个 JS - 对象移动时奇怪的光线转换行为

Angular - 模型和服务之间的区别

azure - 停止或禁用 Azure 中的资源组

javascript - 缩放图像灯箱

javascript - typescript :找不到 namespace

typescript - TypeScript 接口(interface)可以要求多个字符串键或值相同吗?

azure - 如何创建将启动 VM 然后在 VM 上执行(本地或 Azure)脚本的 Azure 自动化 Runbook?

c# - Azure 功能身份验证 - 可以在没有 AD 的情况下吗?