Search code examples
powerbiazure-active-directorypostmanazure-authentication

Unable to generate access token for Powerbi


My ask is to generate a token for Power Bi so to achieve it I created an application for organization by selecting Embedded for your organization So, to integrate with Azure AD created the application in Azure AD.

The endpoint I used is POST: https://login.microsoftonline.com/common/oauth2/token

and in the body tab, I gave the below inputs:

data: {
    grant_type: password
    scope:
    resource:
    client_id:
    username:
    password:
    }

My requirement is to generate token with ROPC authentication flow only.

This is the page I am referring to Solved: Re: How to generate the authorization code and the... - Microsoft Power BI Community

But after hitting send got this error:

{
"error": "invalid_request",
"error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: \r\nCorrelation ID: \r\nTimestamp: 2022-09-25 13:40:05Z",
]

Not sure what am I missing in configuring the application or postman. Any suggestions?


Solution

  • I tried to reproduce the same in my environment and got the same error as below:

    POST: https://login.microsoftonline.com/common/oauth2/token
    data: {
        grant_type: password
        scope: openid
        resource: https://analysis.windows.net/powerbi/api
        client_id: ******
        username: ******
        password: ******
        }
    

    enter image description here

    If your application is not public, then add client_secret parameter like below:

    To resolve the error, add the parameters in Body tab -> x-www-form-urlencoded

    I am able to generate the access token successfully like below:

    enter image description here enter image description here