Expected or Desired Behavior :
SPFx Web部件调用通过Azure AD保护的API,API将数据返回到Web部件 . 这在本地工作台中很有效 . 当我在SharePoint托管工作台中尝试时,它不起作用 . 即使将它捆绑并作为应用程序放在SP上,它仍然无法正常工作 .
Observed Behavior :
我看到弹出窗口出现并在Web部件上返回错误 -
错误:由于超时,令牌续订操作失败
Steps to Reproduce :
-
创建https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/connect-to-api-secured-with-aad#create-a-new-aspnet-web-api-project中定义的API并在https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/connect-to-api-secured-with-aad#secure-the-api-using-openid之前停止
-
API已在AzureSubscription1上发布 .
-
在AzureSubscription2(基于Azure AD的订阅)中,使用https://docs.microsoft.com/en-us/azure/app-service/app-service-mobile-how-to-configure-active-directory-authentication#a-nameadvanced-aalternative-method-manually-configure-azure-active-directory-with-advanced-settings中的指导,https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/connect-to-api-secured-with-aad#register-azure-ad-application中定义的完整6步骤流程 .
-
在AzureSubscription2中,注册一个包含详细信息的应用程序
一个 . 作为名称使用订单
湾因为登录URL使用https://your-machine:4321/temp/workbench.html,其中您的机器是您的开发者机器的名称
C . 添加其他应用程序的权限
一世 . 更改过滤器以显示所有应用程序
II . 从应用程序列表中选择Orders API
III . 委派权限列表选择"App created in step 3" .
d . 启用隐式流和授予权限 .
在这项工作中扩展的样本 -
https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-aad-webapi