question

Arun-9177 avatar image
0 Votes"
Arun-9177 asked ShwetaChoudhary-8869 answered

cant create Calendar events using rest API


I am using rest APIs to do Oauth 2.0( code flow) to get AccessToken.

with the help of the token I can fetch calendar events but not able to create event into the calendar got an Invalid Auth token error.

URL: https://graph.microsoft.com/v1.0/me/events

the scopes are https://graph.microsoft.com/Calendars.ReadWrite Calendars.ReadWrite.Shared offline_access

I have granted delegate Permissions 103186-permisson.png

still getting this error following errors

103271-error.png

 {"error":
  {"code":"Authorization_RequestDenied",
   "message":"Insufficient privileges to complete the operation.",
   "innerError": {"date":"2021-06-07T18:43:59","request-id":"78d2ecbf-6c88-4ae1-a9d5-207a1162463c","client-request-id":"78d2ecbf-6c88-4ae1-a9d5-207a1162463c"}}}



microsoft-graph-calendar
permisson.png (111.6 KiB)
error.png (173.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ShwetaChoudhary-8869 avatar image
0 Votes"
ShwetaChoudhary-8869 answered

That error is returned from the Microsoft Graph API. Whenever you have a token problem like that, it's always helpful to parse the token and see if there's something wrong with it (as the error indicates). Can you try parsing it at https://jwt.ms?

Also, what type of account are you signing in with, an Office 365 account, or a personal Outlook.com account?

Do check <token> part. Is it bytes rather than a utf-8 decoded string?

To check if this is really a token issue, try this: can you go to Graph Explorer and try signing in with that same account, then see if you can make same API call?

Please upvote if this helps. Thanks!

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.