Michael
Michael

Reputation: 876

API returns Forbidden when creating an online meeting endpoint

I am trying to create an online meeting endpoint.

The token has the correct scopes ("scp": "OnlineMeetings.ReadWrite openid TeamsApp.ReadWrite profile email") but when I call POST /v1.0/me/onlineMeetings with the following body

{
  "startDateTime":"2019-07-12T14:30:34.2444915-07:00",
  "endDateTime":"2019-07-12T15:00:34.2464912-07:00",
  "subject":"User Token Meeting"
}

I get:

{
    "error": {
        "code": "Forbidden",
        "message": "Forbidden",
        "innerError": {
            "date": "2021-01-06T13:35:38",
            "request-id": "cc25adbc-2e37-4626-8c14-4f90038056cd",
            "client-request-id": "cc25adbc-2e37-4626-8c14-4f90038056cd"
        }
    }
}

I also get a forbidden response when using the Graph Explorer.

Upvotes: 0

Views: 185

Answers (2)

Michael
Michael

Reputation: 876

The problem was that I authorized the user against specific tenant:

https://login.microsoftonline.com/550fae72-d251-43ec-868c-373732c2704f/oauth2/v2.0/authorize

Instead of:

https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize

Upvotes: 0

Carl Zhao
Carl Zhao

Reputation: 9519

The api call only supports work or school account login, does not support Microsoft personal accounts, nor does it support guest accounts. check!

enter image description here

enter image description here


Update:

  1. Make sure you are logged in to a work account (It is an AAD account, not a B2C account). If you call https://graph.microsoft.com/v1.0/me, you will find that the ID of your work account is like this, "id": "987932c9-f062-48e2- 8ced-22cb6896dfce" and the ID of the Microsoft account is like this "id": "5d9ee9b4b2ad3bfe".

  2. Parse your access token and make sure that the acct claim is 0.

  3. Try to add the organizer in the request body:

{
      "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"
            }
          }
        }
      }
    }

Upvotes: 1

Related Questions