sharad srivastava
sharad srivastava

Reputation: 1

Getting Forbidden 403 error while creating OnlineMeeting using Microsoft Graph api

I am trying to create online meeting through https://graph.microsoft.com/beta/communications/onlineMeetings . initially i got the 403 Forbidden error. then i give the Delegated and Application permissions(OnlineMeetings.ReadWrite,OnlineMeetings.ReadWrite.All) on my registered app on azure.then 403 error is gone and i got new error 400 bad request(Organizer.Identity.User.Id missing). then i supply Online meeting post request as follows-:

{
  "startDateTime":"2020-04-20T14:33:30.8546353-07:00",
  "endDateTime":"2020-04-20T15:03:30.8566356-07:00",
  "subject":"Application Token Meeting",
  "participants": {
    "organizer": {
      "identity": {
        "user": {
          "id": "cb6d6636-1c9e-457c-b904-5da8265a8927"
        }
      }
    }
  }
}

again i got 403 Forbidden error. i created user with the help of https://graph.microsoft.com/v1.0/users and https://graph.microsoft.com/beta/invitations. user is created in my app on azure and i give the permission (User.ReadWrite.All, Directory.ReadWrite.All, Directory.AccessAsUser.All,User.ReadWrite.All, Directory.ReadWrite.All) but error(403) did not change.

My question is that how to give user authorization in microsoft graph API.

Upvotes: 0

Views: 2133

Answers (1)

Allen Wu
Allen Wu

Reputation: 16458

The required permission is Delegated Permission: OnlineMeetings.ReadWrite. See reference here.

403 error means your access token doesn't include the required permission. You can add it like this:

enter image description here

Don't forget to click on "Grant admin consent for {your tenant}".

enter image description here

You should implement Get access on behalf of a user and get an access token to call /communications/onlineMeetings endpoint.

The http sample for your reference:

POST https://graph.microsoft.com/beta/communications/onlineMeetings
Content-Type: application/json
Authorization: Bearer {access token}

{
  "startDateTime":"2019-09-09T14:33:30.8546353-07:00",
  "endDateTime":"2019-09-09T15:03:30.8566356-07:00",
  "subject":"Application Token Meeting",
  "participants": {
    "organizer": {
      "identity": {
        "user": {
          "id": "550fae72-d251-43ec-868c-373732c2704f"
        }
      }
    }
  }
}

You can learn more details about Use the access token to call Microsoft Graph. Don't forget to put Authorization: Bearer {access token} in the request headers.

Upvotes: 0

Related Questions