Good day SO people.
I am trying to create a REST web service to access MS Graph Calendar API. I would like to test this via postman first before I start to code. After some researching below is what I've reached so far.
https://www.getpostman.com/oauth2/callback
. Although, I think I won't be using this because what I need is a seamless login. I don't want to spawn a browser for me to supply my Microsoft account for authorization and authentication.Upon reading, there are many grant types for you to be authorized and authenticated to use MS Graph APIs. One is Authorization Code Grant Flow which spawns an interface for you to sign-in your Microsoft or AAD account. As mentioned above I need the seamless login so I've tried Client Credentials Grant Type
and Resource Owner Grant Type
.
Assuming that I'm all set, I tried to get an access token using this URL:
https://login.microsoftonline.com/substitute-with-tenant-directory-id/oauth2/v2.0/token
I was able to get an access token using the resource owner grant type. Below is the screen capture.
Next, I tried to access the specific API that I need. Here is the URL:
https://graph.microsoft.com/v1.0/me/calendar/calendarView?startDateTime=2018-08-01T00:00:00.0000000&endDateTime=2018-08-31T23:59:59.0000000
I've also tried to replace the "me" part in the URL with "users/substitute-with-user-id" but unfortunately I'm getting an error. Below is the screen capture.
I'm stuck because the response says "Unknown Error". Does anybody know what I am missing here?
It is delegated permission token, you can only get current login user's calendar event. If you want to load other user's event, you can use app-only token. Refer to https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_service to know how to get app-only token.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With