【问题标题】:MS Graph API's subscription create to OnlineMessages failsMS Graph API 对 OnlineMessages 的订阅创建失败
【发布时间】:2022-08-24 15:41:04
【问题描述】:

我正在尝试使用节点 ms 图形客户端创建对资源 /communications/onlineMeetings/?$filter=JoinWebUrl eq \'{JoinWebUrl}\' 的订阅。

为此,我有:

  • 两个租户,一个拥有有效的 MS Teams 许可证(Office 365 开发人员),而另一个租户包含我的客户端应用程序,它是一个多租户应用程序。
  • 向客户端应用添加了所需的范围(应用级别范围:OnlineMeetings.Read.All)
  • 在管理员同意 MS Teams 租户的客户端应用程序的情况下。下面的屏幕截图显示了 MS Teams 租户中的客户端应用范围详细信息。

  • 在客户端应用程序中初始化 MSAL 身份验证库,如下所示:
const authApp = new ConfidentialClientApplication({
  auth: {
    clientId: \'app-client-id\',
    clientSecret: \'app-client-secret\',
    authority: `https://login.microsoftonline.com/${tenantId}`,
  },
});
  • 通过调用获得了一个 accessToken:
const authContext = await authApp.acquireTokenByClientCredential({
  authority: `https://login.microsoftonline.com/${tenantId}`,
  scopes: [\'https://graph.microsoft.com/.default\'],
  skipCache: true,
});

const accessToken = authContext.accessToken;
  • 按如下方式初始化 MS Graph 客户端:
const client = MSClient.init({
  debugLogging: true,
  authProvider: (done) => {
    done(null, accessToken);
  },
});
  • 使用以下调用成功地为CallRecords.Read.All 范围(正确地向定义的 webhook 发送通话记录通知)创建了订阅:
const subscription = await client
  .api(\'/subscriptions\')
  .version(\'beta\')
  .create({
    changeType: \'created,updated\',
    notificationUrl: `https://my-ngrok-url`,
    resource: \'/communications/callrecords\',
    clientState: \'some-state\',
    expirationDateTime: \'date-time\',
});
  • 尝试使用以下调用为OnlineMeetings.Read.All 范围创建订阅:
const subscription = await client
  .api(\'/subscriptions\')
  .version(\'beta\')
  .create({
    resource: `/communications/onlineMeetings/?$filter=JoinWebUrl eq \'{JoinWebUrl}\'`,
    changeType: \'created,updated\',
    notificationUrl: `https://my-ngrok-url`,
    clientState: \'some-state\',
    expirationDateTime: \'date-time\',
    includeResourceData: true,
    encryptionCertificate: \'serialized-cert\',
    encryptionCertificateId: \'cert-id\',
});

这会导致错误消息:

GraphError: Operation: Create; Exception: [Status Code: Forbidden; 
Reason: The meeting tenant does not match the token tenant.]

我不确定是什么原因造成的,以及如何进一步调试它。任何帮助将非常感激。

  • @SrideviM 显然这不是问题,因为其他订阅工作正常,不是吗?
  • 另请参阅:github.com/AzureAD/microsoft-authentication-library-for-js/blob/… 用于在给定多个租户和客户端应用程序同意范围的情况下进行 msal 初始化。我相信代码是正确的(至少根据文档)。在针对me/events 创建订阅时,我确实将/common 端点用于个人帐户,这也可以正常工作。

标签: azure-active-directory microsoft-graph-api multi-tenant subscription


【解决方案1】:

我对资源定义中 joinWebUrl 的理解不正确—— joinWebUrl 是实际在线会议 URL 的占位符(而不是所有已创建会议的全部内容)。

然而,我希望实现的是(目前)不可能,即在特定用户的加入/离开事件上创建对任何在线会议的订阅。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-04
    • 1970-01-01
    • 2019-05-15
    • 1970-01-01
    • 1970-01-01
    • 2021-12-03
    相关资源
    最近更新 更多