An Application has been registered in Azure Active Directory and all the client IDs, client secrets, and tenant IDs have been created.
After I give User.ReadWrite, User.All and Directory.All accesses in both applications and delegated type on Microsoft graph API.
I tried using this API https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token to get bearer token using the request body:
clientID:{clientId}, clientSecret:{clientSecret}, grant_type:client_credentials scope:https://graph.microsoft.com/.default
After getting the bearer token with that I am not able to create a user using the below graph API https://graph.microsoft.com/v1.0/users, I get this error.
"error": { "code": "Authorization_IdentityNotFound", "message": "The identity of the calling application could not be established.", }
Could anybody tell me how to create a new user using this API? Could anybody tell me I was correct on authorization? If no tell me how to?