1

I need to use the MS Graph API to retrieve calendar data for Office365 resources. We need to do this in a server app, so prior consent is needed. I created an app registration in the Azure Portal that provides API permissions for Calendars.read, Calendars.read.shared, Users.Read.All, among other permissions. Admin permission has been granted for all. A client secret was created to support token issue.

I am successful in obtaining a token, but when I use the token to read a resource calendar (or even my calendar,)

I receive the following error:

 "code": "NoPermissionsInAccessToken",

 "message": "The token contains no permissions, or permissions can not be understood."

URL for GET request is something similar to the following: https://graph.microsoft.com/v1.0/users/conferenceroom1@contoso.com/calendar

What's the proper to set up a registration and use keys/secrets to read graph api data for resource mailbox calendar events?

Ghonima
  • 2,978
  • 2
  • 14
  • 23
stickybun
  • 33
  • 3
  • Can you share how you ask for the token? Either source API or actual http request from Fiddler (remove any secrets before sharing). Could it be that you are not requesting the token to https://graph.microsoft.com/.default (application token to Graph)? – Marc May 08 '19 at 00:27
  • Hope you are trying below API, https://learn.microsoft.com/en-us/graph/api/user-list-calendars?view=graph-rest-1.0&tabs=cs – Inzi May 08 '19 at 01:34
  • Can You recheck whether you have given all the permission to your AAD application and AAD Global Admin has to grant permission – Inzi May 08 '19 at 01:35
  • Did you require *application* permissions? Delegated permissions won't work in your scenario. – juunas May 08 '19 at 04:26

1 Answers1

0

It seems that you granted delegated permissions, but you need the application permissions. Remember to grant admin consent after adding the permissions.

enter image description here

You can decode your token to check if you have the correct permissions by using https://jwt.io/

enter image description here

Tony Ju
  • 14,891
  • 3
  • 17
  • 31