Solved: Getting forbidden when try to create an online meeting using Microsoft Graph with application token

只愿长相守 提交于 2020-01-30 11:52:08

问题


Problem:

I need to create an online meeting using Microsoft Graph without an authenticated user. So, I'm getting forbidden status when try to create the online meeting with application token. We have setted the required permissions OnlineMeetings.ReadWrite.All for Application and we have getted administrator consent but is not running.

I have followed steps according to Microsoft documentation in https://docs.microsoft.com/en-us/graph/auth-v2-service and https://docs.microsoft.com/en-us/graph/api/application-post-onlinemeetings

  1. Register the application (successful)
  2. Configure permissions for Microsoft Graph (successful) Permissions for Microsoft Graph
  3. Get administrator consent (successful)
  4. Get an access token (successful)
  5. Use the access token to call Microsoft Graph and Create an online meeting with application token (forbidden)

Error details:

Endpoint: https://graph.microsoft.com/beta/communications/onlineMeetings

Method: POST

Header: Authorization: Bearer {access_token}

Request body:

{
  "isBroadcast": "false",
  "startDateTime":"2019-12-04T14:30:00.8546353-05:00",
  "endDateTime":"2019-12-04T15:00:00.8566356-05:00",
  "subject":"Subject",
  "participants": {
    "organizer": {
      "identity": {
        "user": {
          "id": "user-id"
        }
      }
    }
  }
}

Response:

{
  "error": {
    "code": "Forbidden",
    "message": "",
    "innerError": {
      "request-id": "3aa2473b-ab48-4c58-b3f4-be9a34f15be3",
      "date": "2019-12-10T19:23:53"
    }
  }
}

Thanks in advance for somebody can help me.

Solution:

The problem was found in step 4 because I was trying to get an access token for my application with next endpoint url:

https://login.microsoftonline.com/common/oauth2/v2.0/token

Where common acts as tenant id.

Searching another problem, also with Microsoft Graph, I found the problem, which is that precisely. I had to change common by the tenant id of my application on Azure AD, as show next:

https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token

And all is running.

来源:https://stackoverflow.com/questions/59276045/solved-getting-forbidden-when-try-to-create-an-online-meeting-using-microsoft-g

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!