0
votes

I want to build a sample application which can read the calendar of outlook account either live or office365 using Microsoft graph API.

The case I am trying to implement is Microsoft Graph : Get access without a user

  1. I created a personal account on outlook live.
  2. Registered an application on Azure Portal.
  3. Next step was to get admin consent.
  4. For Admin consent I tried to hit :

    https://login.microsoftonline.com/common/adminconsent ?client_id=clientId &state=state &redirect_uri=redirect-uri

Getting error :

We are unable to issue tokens from this API version for a Microsoft account. Please contact the application vendor as they need to use version 2.0 of the protocol to support this.

1
Are you sure you got the error when getting admin consent? Did you login with the admin account? - Joy Wang-MSFT
@JoyWang I created account on Outlook live so in this case there will not be any admin. But in steps mentioned in the link I must get admin consent in order to get access token. - Nishant Middha
You login the portal with your outlook account to create the application as the reply mentioned? - Joy Wang-MSFT
Yes I logged in to the Azure portal using same personal account and registered my application. - Nishant Middha

1 Answers

3
votes

Since you used your personal account to register the application on Azure portal, you can only get access on behalf of a user. You can only get access to the sign in user calendar.(both personal accounts and o365 accounts)

enter image description here

Authorization request

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?
client_id={your_client_id}
&response_type=code
&redirect_uri=https://localhost/myapp
&response_mode=query
&scope=https://graph.microsoft.com/Calendars.Read
&state=12345

enter image description here

Then you can use the code you got in the url to get the access token.