0
votes

I'm having an issue getting an access token through Postman.

I'm following this process "Flow 2". http://codematters.tech/getting-access-token-for-microsoft-graph-using-oauth-rest-api/

"Flow 1" worked for me.

This is the given scenario. I am sending a post request with body.

POST https://login.microsoftonline.com/e0xxxxxx-xxxx-xxxx-xxxx-xxxx09d53164/oauth2/v2.0/token

{

client_id:id

client_secret:secret

grant_type:password

username:user

password:pass

scope:openid

}

Response -> "AADSTS90002: Tenant ' ' not found. This may happen if there are no active subscriptions for the tenant.

Why would the Tenant be blank given it was populated?

Thank you for your help.

1

1 Answers

0
votes

The URL that you send is wrong. This parameter should not be AAD_name, but tenant.

Try this:

POST: https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded

client_id=xxxxx
&scope=openid
&username=user
&password=pass
&grant_type=password

You could find your tenant in App registrations: enter image description here

For more information, you could see here.


If you want to use {{AAD_name}}, you need to set Environment in postman firstly.

enter image description here

Then you could send the post request like the link shows.