【发布时间】:2017-11-30 11:09:41
【问题描述】:
我在https://apps.dev.microsoft.com上创建了一个应用
具有以下应用程序权限:
Calendars.Read (Admin Only)Calendars.ReadWrite (Admin Only)User.Read.All (Admin Only)
管理员同意
然后通过此 URL 成功授予管理员同意
https://login.microsoftonline.com/strixtechnology.onmicrosoft.com/adminconsent?client_id=bbb35336-faee-4c10-84b4-34136634db41&state=1234&redirect_uri=https%3A%2F%2Fdashmeetings.com%2Fmicrosoft%2Foauth
获取访问令牌
然后从
获得访问令牌POST https://login.microsoftonline.com/common/oauth2/v2.0/token
带有标题
Content-Type=application/x-www-form-urlencoded
和带有键值对的正文
grant_type=client_credentials
client_id=bbb35336-faee-4c10-84b4-34136634db41
client_secret=xxx
scope=https://graph.microsoft.com/.default
这会返回一个访问令牌。
订阅通知
使用该访问令牌,然后我尝试订阅某个资源邮箱上的事件:
POST https://graph.microsoft.com/beta/subscriptions
带有标题
Content-Type=application/json
Authorization=Bearer <access_token_here>
和身体
{
"changeType": "created,updated,deleted",
"notificationUrl": "https://dashmeetings.com/microsoft/notify",
"resource": "users/mahogany@strixtechnology.com/events",
"expirationDateTime":"2017-12-01T11:00:00.0000000Z",
"clientState":"1234"
}
这会返回一个401 Unauthorized
{
"error": {
"code": "ExtensionError",
"message": "Operation: Create; Exception: [Status Code: Unauthorized; Reason: Unauthorized]",
"innerError": {
"request-id": "98ce5e5e-1ce4-4417-8c35-456a3cc0e696",
"date": "2017-11-30T10:59:28"
}
}
}
这个问题似乎与“Resource not found for the segment” using Graph subscription beta 相似,但我按照相同的步骤进行操作,没有任何运气
【问题讨论】: