0
votes

I am able to authenticate and get an application token to use the Microsoft Graph API. I have set all of the delegated and admin permissions to have access to the users. I have also used the graph explorer to verify what permissions I need: https://developer.microsoft.com/en-us/graph/graph-explorer#

I verified my user GUID (my ID) through Azure AD as well as the Graph Explorer using their https://graph.microsoft.com/v1.0/me/ call while signed in. Given I'm using the application token so I must specify a user (see below).

Here is what I'm passing

GET https://graph.microsoft.com/v1.0/user/{my GUID from Azure AD}
Authorization: bearer {myAccessToken}
Content-Type: application/json

I suspect it's a syntax issue or a permissions issue.

1
It's https://graph.microsoft.com/v1.0/users/GUID, not user. - juunas
HA! Nice catch. Now I'm getting this--> "Unable to read JSON request payload. Please ensure Content-Type header is set and payload is of valid JSON format"; I am using Content-Type: application/json in the header though. - tjcinnamon
You don't need to set Content-Type, because you are not sending JSON. If you want to accept JSON, use the Accept header instead. - juunas
If I remove Content-type: application/JSON and have Accpet: application/JSON then I get this: "Entity only allows writes with a JSON Content-Type header.", If I use both accept and content type then I get the same error - tjcinnamon
It says I just need the Content-Type and Authorization headers: developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/… - tjcinnamon

1 Answers

2
votes

The URL should be:

https://graph.microsoft.com/v1.0/users/{GUID}

And you instead of a Content-Type header, you should send a:

Accept: application/json