I'm trying to fetch the user's profile photo using https://graph.microsoft.com/v1.0/me/photo/$value endpoint and by following these instructions. In our React app we're using react-adal, so I first got an access token using adalGetToken(authContext, "https://graph.microsoft.com/") and then made the call with
axios.get("https://graph.microsoft.com/v1.0/me/photo/$value", {
headers: {
Authorization: `Bearer ${token}`,
},
})
However, the response is
{
"error": {
"code": "NoPermissionsInAccessToken",
"message": "The token contains no permissions, or permissions can not be understood.",
"innerError": {
"request-id": "d2ed76f0-7f35-4014-bc53-xxxxxxxxxxxx",
"date": "2020-05-29T09:27:12"
}
}
}
When I make a call to https://graph.microsoft.com/v1.0/me using the same token, I get a proper response, eg
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
"id": "<id>",
...
}
In Azure Portal I have delegated User.Read permissions for the application: Image of the permissions
What could be the problem?