apioauth-2.0microsoft-graph-apiaccess-tokenoutlook-restapi

ADSTS70000121: The passed grant is from a personal Microsoft account and is required to be sent to the /consumers or /common endpoint


I am trying to retrieve access token to call graph API however i keep getting

ADSTS70000121: The passed grant is from a personal Microsoft account and is required to be sent to the /consumers or /common endpoint

I am sure that I have followed instruction given in official document get access Token

Here in the API end point URI: https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token

Postman setup: enter image description here enter image description here


Solution

  • From the documentation:

    The {tenant} value in the path of the request can be used to control who can sign into the application. The allowed values are common for both Microsoft accounts and work or school accounts, organizations for work or school accounts only, consumers for Microsoft accounts only, and tenant identifiers such as the tenant ID or domain name. For more detail, see protocol basics.


    First, you wrote {tensnt}, not {tenant}. Second, the curly brackets are showing that {tenant} is a variable. If you want to use a variable in postman, you need to initialize a variable with name and value and than you can write {{VARIABLE_NAME}} (double curly brackets!).


    For the variable/placeholder, you can use common, organizations, consumers or a tenant identifier. Because you are using a personal Microsoft account, you have to choose the /consumers or /common endpoint. This will result in:

    https://login.microsoftonline.com/common/oauth2/v2.0/token

    OR

    https://login.microsoftonline.com/consumers/oauth2/v2.0/token