2
votes

I am trying to get access_token using

POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token

endpoint using username and password where tenant = {some tenant id}

The parameters that I am using to make the request are:

client_id:{client_id}
scope:https://graph.microsoft.com/Calendars.ReadWrite
client_secret:{client_secret}
username:{username}
password:{password}
grant_type:password

I am getting the following error in response:

error: invalid_request
error_description : AADSTS90002: Tenant '' not found. This may happen if there are no active subscriptions for the tenant. Check with your subscription administrator.

I have the following permissions for my application available on Azure: enter image description here

The documentation for this is available here : https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth-ropc

2
What are you using for a tenant id? The URI or the GUID?Marc LaFleur
@MarcLaFleur Is tenant id equivalent to subscription id? Do I need to purchase a subscription for my application or the tenant id listed under my application would work?Rajan Sharma
I'm not sure which subscription you mean. Your tenant id is the unique ID of the AAD tenant you're authenticating against. I normally recommend using the URI for the tenant since it's easier to grok. The format is tenant-name.microsoftonline.com.Marc LaFleur

2 Answers

2
votes

On my side, it works. You should check your tenant whether your application is registered in this tenant.

enter image description here

0
votes

I solved this issue by purchasing a subscription and adding my user as an administrator.

After that, I added two permissions to my application to get the delegate access for using ROPC (Resource Owner Password Credential)authentication method and granted them with the administrator consent.

enter image description here enter image description here