I'm getting an "ErrorAccessDenied" when attempting to get user photos with the Microsoft Graph API v1.0.
I can get a user's information by using
var user = graphClient.Users["userprincipalname"].Request().GetAsync();
And I am also able to use
"https://graph.microsoft.com/v1.0/users/userprincipalname/photo/$value"
In Microsoft's graph explorer to get a user's photo
However when I try to use
var user = graphClient.Users["userprincipalname"].Photo.Content.Request().GetAsync();
I get
{Code: ErrorAccessDenied
Message: Access is denied. Check credentials and try again. Inner error
}
But I'm pretty sure my credentials are correct as I could get all the other information regarding the user. My app is registered in Azure Portal and uses the v1.0 endpoint if that helps.
Any help is appreciated, thanks!
If application permissions were updated after the user consented, a re-consent is needed. To force showing consent dialog to user, include prompt=consent query parameter to /authorize request. Example: https://login.microsoftonline.com/common/oauth2/authorize?prompt=consent
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.