I'm using Azure AAD B2C and trying to get the profile photo of a user. The guides are a mess but I got this far.
First I make the following request to get an access token to use as the bearer Authorization header in the subsequent requests.
POST https://login.microsoftonline.com/aureliuspod.onmicrosoft.com/oauth2/v2.0/token
client_id=<client id>
&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
&client_secret=<secret>
&grant_type=client_credentials
Calling https://graph.microsoft.com/v1.0/users
successfully gets me a list of the users in the B2C tenant.
Calling https://graph.microsoft.com/v1.0/users/<oid>
also successfully gets me the user information.
However when I try to call https://graph.microsoft.com/v1.0/users/<oid>/photo/$value
I get the following error:
{
"error": {
"code": "OrganizationFromTenantGuidNotFound",
"message": "The tenant for tenant guid '...' does not exist.",
"innerError": {
"requestId": "...",
"date": "2020-09-30T05:20:40",
"request-id": "...",
"client-request-id": "..."
}
}
}