首页 > 解决方案 > 不清楚要使用什么端点,或者在 AAD 中选择什么应用程序类型

问题描述

我正在编写将在以下平台上运行的加载项 Outlook Online (OWA) Outlook Desktop Client (Outlook 2016) Outlook Mobile (iOS)

插件将调用我们位于本地的内部 WebAPI。

我不清楚的是,我选择的类型Web公共客户端)以及我使用的重定向 URI 是否会有所不同。

我们 WebAPI 的端点是https://ourcompany.com/ourAPI

但是,我看到对于桌面和移动应用程序,门户提供以下选择

msalfa1909ee-89f4-422b-bfea-2e6c00ef1b53://auth https://login.microsoftonline.com/common/oauth2/nativeclient

https://login.live.com/oauth20_desktop.srf

我认为端点是端点是端点;这意味着,只要它是有效的并且提供了正确的信息(例如 clientID、secret 等),无论平台如何,都会在请求时返回一个有效的令牌。

我的初始化代码的开头应该写成这样吗?(我打算使用 MSAL.js)

Office.onReady(info){
   if( info.Platform === "Office.PlatformType.OfficeOnline" ){
       endpoint = "https://ourcompany.com/ourAPI";
   }
   else if( info.Platform === "Office.PlatformType.iOS" ){
       endpoint = "https://login.microsoftonline.com/common/oauth2/nativeclient";
   }
   else if( info.platform === "Office.PlatformType.PC" ){
       endpoint = "msalfa1909ee-89f4-422b-bfea-2e6c00ef1b53://auth"
   }
}

标签: azure-active-directoryoutlook-web-addinsazure-authenticationmsal.js

解决方案


@eZG - 端点是您将调用的受保护 Web API 的 URL(在 Authorization 标头中带有访问令牌)。无论您的应用程序如何,您都将始终调用相同的端点。- 另一方面,回复 URI 是您的客户端应用程序(在这种情况下为您的外接程序)将从 Azure AD 接收访问令牌的 URI,以便您调用 Web API。

有关重定向 URI(回复 URI)的文档位于MSAL | 应用程序配置选项 | 重定向 URI 在桌面应用程序的情况下,


推荐阅读