我需要Microsoft Graph Api的管理员同意吗?

时间:2020-06-23 03:42:38

标签: java microsoft-graph-api

我正在一个需要在日历中创建事件的项目中,为此,我正在使用GRAPH API,并且应该没有用户交互。我正在使用我的个人帐户。

作为一项测试,我正在邮递员中打电话,我将从URL获得的令牌添加到其中。 https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token

https://graph.microsoft.com/v1.0/users/me/events

{
  "subject": "My event",
  "start": {
    "dateTime": "2020-06-22T13:32:53.037Z",
    "timeZone": "UTC"
  },
  "end": {
    "dateTime": "2020-06-29T13:32:53.037Z",
    "timeZone": "UTC"
  }
}

但是我遇到了这个错误

{ "error": { "code": "NoPermissionsInAccessToken", "message": "The token contains no permissions, or permissions can not be understood.", "innerError": { "requestId": "b4ffb07b-8a7b-4893-93ae-1a3bb8be8f28", "date": "2020-06-23T03:14:49", "request-id": "b4ffb07b-8a7b-4893-93ae-1a3bb8be8f28" } } }

这是我令牌的身体 enter image description here


这些是应用程序权限 enter image description here

此错误是因为我没有管理员的同意还是我做错了什么?

1 个答案:

答案 0 :(得分:0)

您是否在Azure AD中注册了应用程序?

请按照此处描述的步骤操作: https://docs.microsoft.com/en-us/graph/auth-v2-service?context=graph%2Fapi%2F1.0&view=graph-rest-1.0

您需要的权限级别是Calendar.ReadWrite