Microsoft graph API-订阅任何日历时发生未经授权的错误

时间:2019-08-13 13:32:40

标签: microsoft-graph microsoft-graph-calendar

我经历了具有权限Calendars.ReadWriteoffline_access的经典oAuth流,这足以创建预订。

现在,我获得了用户日历的列表(通过api),当我尝试通过这样的请求订阅来自任何这些日历的事件时:

POST /v1.0/me/subscriptions HTTP/1.1  Accept: */*  Content-Type: application/json    
{
    "changeType": "created,deleted,updated",
    "notificationURL": "https://...",
    "resource": "/me/calendars/{id}/events",
    "expirationDateTime": "2019-08-15T00:00Z",
    "clientState": "..." 
}

(甚至是"resource": ,"/me/events"

我得到答复:

401 - Unauthorized: Access is denied due to invalid credentials.

You do not have permission to view this directory or page using the credentials that you supplied.

我在这里做什么错了?

1 个答案:

答案 0 :(得分:0)

错误在于请求网址内:POST /v1.0/me/subscriptions实际上应该是POST /v1.0/subscriptions(不带我)