【问题标题】:Microsoft Graph API Beta: Subscribe to Event Notifications of another userMicrosoft Graph API Beta:订阅其他用户的事件通知
【发布时间】: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 相似,但我按照相同的步骤进行操作,没有任何运气

【问题讨论】:

    标签: microsoft-graph-api


    【解决方案1】:

    管理员同意 URL 必须是

    https://login.microsoftonline.com/common/adminconsent?client‌​_id=bbb35336-faee-4c‌​10-84b4-34136634db41‌​&state=1234&redirect‌​_uri=https%3A%2F%2Fd‌​ashmeetings.com%2Fmi‌​crosoft%2Foauth
    

    和访问令牌地址:

    https://login.microsoftonline.com/&lt;tenant_id&gt;/oauth2/v2.0/to‌​ken

    【讨论】:

    • 嗨!这里的 是什么?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-05
    • 1970-01-01
    相关资源
    最近更新 更多