我正在尝试使用 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/