错误:AADSTS500011:在租户中找不到名为“URL”的资源主体

Dan*_*Dan 7 javascript azure typescript azure-active-directory sharepoint-online

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

有其他人遇到过这个问题或者知道在哪里寻找这个问题吗?

发现 [object Object]驱动程序显示外部错误:错误:AADSTS500011:在名为 7018324c-9efd-4880-809d-b2e6bb1606b6 的租户中找不到名为https://driverdisplayexternal.azurewebsites.net的资源主体。如果应用程序尚未由租户管理员安装或未得到租户中任何用户的同意,则可能会发生这种情况。您可能已将身份验证请求发送给了错误的租户。跟踪 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);
          });
      });
...
Run Code Online (Sandbox Code Playgroud)

包解决方案.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"
  }
}

Run Code Online (Sandbox Code Playgroud)

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

juu*_*nas 2

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

      .getClient('https://driverdisplayexternal.azurewebsites.net')
Run Code Online (Sandbox Code Playgroud)

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