Asaf
Asaf

Reputation: 8216

Access Token missing or malformed when calling Graph API

Following this guide: https://azure.microsoft.com/en-us/documentation/articles/resource-manager-api-authentication/#_get-objectid-of-application-service-principal-in-user-azure-ad

I've reached the stage where I call graph.windows.net to Get the ObjectId of the service principal in user Azure AD.

When I do the call, however, I'm getting the following message:

{"odata.error":{"code":"Authentication_MissingOrMalformed","message":{"lang":"en","value":"Access Token missing or malformed."},"values":null}}

I've already tried replacing the clientId with the 'onmicrosoft.com' address too (so graph.windows.net/appname.onmicrosoft.com/...), still got the same message.

Upvotes: 13

Views: 13321

Answers (2)

user22389232
user22389232

Reputation: 1

This is one of the sarcastically easy fixes I have seen. I was using the Microsoft browser and just downloaded chrome and it worked!

Upvotes: 0

jimpaine
jimpaine

Reputation: 887

To extend on my comment, we have seen this when the app secret contains characters that need encoding. Such as "+" and "="

enter image description here

If you are not using some of the client helpers available or are testing with Fiddler or Postman you will need to URL encode the secret before calling the graph api, so it looks it becomes:

"7hIkYG5m7xJQnocThxMc4yPjtbRP7bO41aNC%2bbrEzvo%3d"

Upvotes: 3

Related Questions