3

有没有人幸运地创建了一个 webhook 来接收有关 O365 日历事件更改的通知?我在 Outlook Notifications REST API 上取得了成功,但在新的 Microsoft Graph API 上尝试同样的事情却是一段坎坷的旅程。

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

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需要权限。

我想知道我做错了什么,或者可能是创建订阅服务无法正确处理仅限应用程序的令牌?

编辑:

解码后的令牌是:

{
 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"
}.
4

1 回答 1

2

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.

于 2015-12-02T08:07:35.773 回答