I'm trying to get all the users for a multi-tenant application using the graph API. For the purpose, I generated the access token using the request:
POST https://login.microsoftonline.com/common/oauth2/v2.0/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
client_id=535fb089-9ff3-47b6-9bfb-4f1264799865
&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
&client_secret=qWgdYAmab0YSkuL1qKv5bPX
&grant_type=client_credentials
Note: Please note that, in above request, I used common in place of {tenantID}. That was just a hit and try as the same was suggested for adminConsent in the doc.
By using the above generated access token, I requested the user API and got the following error
{
"error": {
"code": "Authorization_IdentityNotFound",
"message": "The identity of the calling application could not be established.",
"innerError": {
"request-id": "56141b7d-dd5e-44b1-9395-cd15d02b52de",
"date": "2019-06-17T12:42:19"
}
}
}
And when I generate the token using tenant ID, it only returns the users of one active directory.
Can anyone suggest, where I'm going wrong?

