I'm able to get the users token for my react app for the graph API but I'm getting an error on the request for
https://graph.microsoft.com/v1.0/users/me/photo/$value
I'm using the scope https://graph.microsoft.com/User.Read on the MSAL with this code:
const GraphRequest = {
scopes: ["https://graph.microsoft.com/User.Read"],
account: accounts[0],
};
instance.acquireTokenSilent(GraphRequest).then((graphResponse) => {
setBearerToken(graphResponse.accessToken);
with this token I do the get request like so:
Axios.get(`https://graph.microsoft.com/v1.0/users/me/photo/$value`, {
headers: { Authorization: `bearer ${BearerToken}` },
responseType: "blob",
}).then((o) => {
const url = window.URL || window.webkitURL;
const blobUrl = url.createObjectURL(o.data);
setImageUrl(blobUrl);
});
the problem is the return shows no error message its blank and I'm not sure what the error is it just says 401 unauthorized
{
"error": {
"code": "UnknownError",
"message": "",
}
in the azure app registry I have permissions for user profile and the user.read so not sure where else to go here without a reason for the error I get the same in postman
Update
changed url request to https://graph.microsoft.com/v1.0/me/photo/$value
and still get the same issue and in post man