Access is denied. Check credentials and try again

Pradeep Singh Rao 21 Reputation points
2021-01-13T09:25:23.25+00:00

Getting this response while calling: https://graph.microsoft.com/v1.0/me/calendar/getSchedule API

  1. Created App on Azure Directory
  2. Given below permissions
    Delegated and Application Permission:- Calendars.Read, Calendars.Read.All, Calendars.ReadWrite
  3. Given admin consent
  4. Got the Access token from:
    https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token
    client_id={clientid}
    &scope=https://graph.microsoft.com/.default
    &grant_type=client_credentials
    &client_secret={secret}
  5. Received access token from above API
  6. Used this as a bearer token in https://graph.microsoft.com/v1.0/me/calendar/getSchedule API

getting
{
"error": {
"code": "ErrorAccessDenied",
"message": "Access is denied. Check credentials and try again."
}
}

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
23,174 questions
{count} votes

Accepted answer
  1. VipulSparsh-MSFT 16,296 Reputation points Microsoft Employee
    2021-01-13T12:51:52.523+00:00

    @Pradeep Singh Rao Thanks for reaching out.
    If you are using the client creds flow, you should not use the /me endpoint, instead you should use /users/{userID}/calendar/getSchedule

    So the resource URL will look something like this :
    https://graph.microsoft.com/v1.0/users/2fd17daa-31d6-4a0c-2345-77a01239a3d1/calendar/getSchedule

    Also remember the supported method to get the schedule is POST.

    So try something like this :

    56185-image.png


0 additional answers

Sort by: Most helpful

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.