SPFXAzure Ad-SecedAPI

问题描述 投票:0回答:0

我现在想在Microsoft的此示例之后使用自定义的SPFX解决方案使用此安全API:

Connect到SharePoint Framework中的Azure Ad-Sear-Sead APIS Solutions

包装 - 解决方案 "webApiPermissionRequests": [ { "resource": "SharePoint App", //Display name of the azure app "scope": "access" } ]

代码获取API数据:

props.context.aadHttpClientFactory .getClient('https://sharepoint-api:4444') .then((client: AadHttpClient): void => { client .get('https://sharepoint-api:4444/data', AadHttpClient.configurations.v1) .then((response: HttpClientResponse): Promise<any> => { return response.json(); }) .then((data: any): void => { console.log(data); }) });
无论我将什么插入getClient()我会遇到一个错误500作为响应:

<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <m:code>-1, System.AggregateException</m:code> <m:message xml:lang="de-DE">One or more errors occurred.</m:message> </m:error>
如果我在Graph API中使用相同的代码,则没有任何问题:

props.context.aadHttpClientFactory .getClient('https://graph.microsoft.com') .then((client: AadHttpClient): void => { client .get('https://graph.microsoft.com/v1.0/me', AadHttpClient.configurations.v1) .then((response: HttpClientResponse): Promise<any> => { return response.json(); }) .then((data: any): void => { console.log(data); }) });
我需要更改以使自定义API正常工作?

您已从M365 SharePoint Admin Center-> API访问中授予Web Part SPO管理员同意。图形将在任何较旧的管理员同意下工作,但是对于任何新的应用注册管理员都需要授予其工作的同意。
    

azure api oauth spfx
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.