使用Microsoft Graph API创建Webhook时遇到问题 [英] Trouble creating a webhook using the Microsoft Graph API

查看:69
本文介绍了使用Microsoft Graph API创建Webhook时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人幸运地创建了一个Webhook来接收有关O365日历事件更改的通知吗?我已经成功使用Outlook Notifications REST API,但尝试使用新的Microsoft Graph API进行同样的尝试却很坎

Has anyone had any luck creating a webhook to receive notifications about changes to O365 calendar's events? I've been successful with the Outlook Notifications REST API, but trying the same with the new Microsoft Graph API has been a bumpy ride.

我已经获得了 https://graph.microsoft.com 的仅应用程序令牌,我可以通常同时使用v1.0和beta端点服务就可以了.但是,当我尝试创建新的订阅时(POST https://graph.microsoft.com/beta/subscriptions ),我得到了一个相当模糊的错误:

I've acquired an app-only token for https://graph.microsoft.com and I can generally use both v1.0- and beta-endpoint services just fine. However, when I try to create a new subscription (POST https://graph.microsoft.com/beta/subscriptions), I get this rather blurry error:

401 Unauthorized: {
  "error": {
    "code": "",
    "message": "Invalid security token.",
    "innerError": {
      "request-id": "c5a64878-e643-41be-b863-a598e05f38a4",
      "date": "2015-11-28T17:59:24"
    }
  }
}

我已为我的应用授予以下应用程序权限: Microsoft Graph-读取所有用户的完整配置文件,读取目录数据读取所有邮箱中的日历.根据文档 Calendars.Read 的权限,是必需的.

I've given the following application permissions to my app: Microsoft Graph - Read all users' full profiles, Read directory data, and Read calendars in all mailboxes. According to the documentation Calendars.Read permission is required.

我想知道我在做错什么,还是创建订阅服务无法正确处理仅应用令牌的令牌?

I wonder what I'm doing wrong or might it be that the create subscription service is unable to properly handle app-only token's?

解码后的令牌为:

{
 typ: "JWT",
 alg: "RS256",
 x5t: "MnC_VZcATfM5pOYiJHMba9goEKY",
 kid: "MnC_VZcATfM5pOYiJHMba9goEKY"
}.
{
 aud: "https://graph.microsoft.com/",
 iss: "https://sts.windows.net/58108de9-edf3-####-b20b-817520334d13/",
 iat: 1448814967,
 nbf: 1448814967,
 exp: 1448818867,
 appid: "5e80f22f-ff14-####-962a-2a9362a6057c",
 appidacr: "2",
 idp: "https://sts.windows.net/58108de9-edf3-####-b20b-817520334d13/",
 oid: "87b9064d-3dc7-####-9071-7a61b5b57840",
 roles: [
  "Calendars.Read",
  "Directory.Read.All",
  "User.Read.All"
 ],
 sub: "87b9064d-3dc7-####-9071-7a61b5b57840",
 tid: "58108de9-edf3-####-b20b-817520334d13",
 ver: "1.0"
}.

推荐答案

订阅目前基于每个用户,因此无法使用仅应用程序令牌创建订阅.感谢您提供的反馈意见,我们将考虑增加对此方案的支持.

Subscriptions are on a per user basis right now, therefore they cannot be created using an app-only token. Thank you for the feedback we will look into adding support for this scenario.

这篇关于使用Microsoft Graph API创建Webhook时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆