cant create Calendar events using rest API

Arun 1 Reputation point
2021-06-08T04:08:40.577+00:00

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 Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Choudhary 606 Reputation points Microsoft Employee
    2021-06-09T11:49:26.597+00:00

    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!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.