问题
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
- Register the application (successful)
- Configure permissions for Microsoft Graph (successful) Permissions for Microsoft Graph
- Get administrator consent (successful)
- Get an access token (successful)
- 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