{
"error": {
"code": "UnableToReadToken",
"message": "OAuth token submitted with the request can not be parsed.",
"innerError": {
"request-id": "880a2e95-5e47-4b74-9ff5-c5f4e9a9feed",
"date": "2020-04-16T10:47:11"
}
}
}
I tried to get an access token for https://graph.microsoft.com/v1.0/users/{userPrincipalName}/photo/$value and I found that the graph does not support for the personal account.
The error message is as below:
{
"error": {
"code": "NoPermissionsInAccessToken",
"message": "The token contains no permissions, or permissions can not be understood.",
"innerError": {
"request-id": "5f885aa4-8b13-4fdb-a2c2-cdad64797f9a",
"date": "2020-04-17T07:38:47"
}
}
}
Suggestion:
Then I found there is another post on stackoverflow where the post said that he solved the problem by telling the "https://login.microsoftonline.com/common/oauth2/token"endpoint what he needed the token for and passing a
"resource=[resource-endpoint]" in the body sent to "login.microsoftonline.com/common/oauth2/token".
More details, you could check below link in case you met the problem in a similar scenario.
ASP.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
Thank you for your investigation. The resource is actually specified at AcquireTokenSilentAsync and AcquireTokenAsync. In my case, it's https://graph.microsoft.com.
Then again, you're right! The graph does not support personal accounts :(
Member
1 Points
25 Posts
Can't get user photo using graph.microsoft.com
Apr 16, 2020 10:57 AM|suencien|LINK
Hi guys,
I've managed to get access token from OpenID Connect authentication, but am struggling to get user's photo using graph.microsoft.com.
I've set the header to include Authorization and Bearer [access_token] as key and value and the GET request is https://graph.microsoft.com/v1.0/users/suencien@hotmail.com/photo/$value
suencien@hotmail.com is the authenticated email address.
The response I get is:
The access_token is
Does anyone know what I got wrong?
Contributor
3020 Points
889 Posts
Re: Can't get user photo using graph.microsoft.com
Apr 17, 2020 07:47 AM|Sean Fang|LINK
Hi suencien,
From the error message, I think the problem is not caused by a wrong token. Otherwise, the error message should be as below:
I tried to get an access token for https://graph.microsoft.com/v1.0/users/{userPrincipalName}/photo/$value and I found that the graph does not support for the personal account.
The error message is as below:
Suggestion:
Then I found there is another post on stackoverflow where the post said that he solved the problem by telling the "https://login.microsoftonline.com/common/oauth2/token"endpoint what he needed the token for and passing a "resource=[resource-endpoint]" in the body sent to "login.microsoftonline.com/common/oauth2/token".
More details, you could check below link in case you met the problem in a similar scenario.
OAuth token submitted with the request can not be parsed
Hope this can help you.
Best regards,
Sean
Member
1 Points
25 Posts
Re: Can't get user photo using graph.microsoft.com
Apr 18, 2020 02:50 AM|suencien|LINK
Hi Sean,
Thank you for your investigation. The resource is actually specified at AcquireTokenSilentAsync and AcquireTokenAsync. In my case, it's https://graph.microsoft.com.
Then again, you're right! The graph does not support personal accounts :(