cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
alainp Frequent Visitor
Frequent Visitor

Cant authenticate as a user with Postman (400 error)

I posted this as a reply in another thred while it should have been a new post, sorry!

 

So I am trying to use the PBI API via REST requests done by Postman. All of these requests will be done by a service account with a PowerBI Pro license (currently my account for testing purposes) which will copy/modify workspaces so that we can automate the workspace creation process.

 

I know the credentials are working because I can log with them on the PowerBI website and I can make API calls using a Python API library (which unfortunately does not have all the required end points, hence me using Postman).

 

So, when I try to authenticate using Postman, I am getting this:

 

{
    "error": "invalid_grant",
    "error_description": "AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password\r\nTrace ID: 3094c744-940a-42ff-ad1f-acb1ad2c3b00\r\nCorrelation ID: 3300c98a-f742-4664-850a-ef04b6032244\r\nTimestamp: 2018-10-19 12:22:37Z",
    "error_codes": [
        70002,
        50126
    ],
    "timestamp": "2018-10-19 12:22:37Z",
    "trace_id": "3094c744-940a-42ff-ad1f-acb1ad2c3b00",
    "correlation_id": "3300c98a-f742-4664-850a-ef04b6032244"
}

My request:

 

POST https://login.microsoftonline.com/common/oauth2/token

and the payload:

 

grant_type: password
client_id: {{client_id}}
resource: https://analysis.windows.net/powerbi/api
scope: openid
username: {{username}}
password: {{password}}

From what I have seen in the forum, this _should_ work. Has something changed recently that breaks this way of authentication? If there something wrong with my account?

4 REPLIES 4
NEbdf Frequent Visitor
Frequent Visitor

Re: Cant authenticate as a user with Postman (400 error)

Sorry, no solution here. But I am having the same issue since over half a year. Only the C# demo of MS seemed to work, nothing else. Would love to hear of someone getting the Token API working in Postman.

alainp Frequent Visitor
Frequent Visitor

Re: Cant authenticate as a user with Postman (400 error)

I managed to make it work by asking my azure sysadmin to create a service account and making this account the owner of the app. I dont understand why it would make it different than using my own credentials (with me as owner) but apparently, it does because now I can log via password... 

NEbdf Frequent Visitor
Frequent Visitor

Re: Cant authenticate as a user with Postman (400 error)

Do you maybe have some more detailed informations regarding that service account and how it is created? I would like to ask my Azure Admin too for that, but might have to point in the right direction. Thanks!

alainp Frequent Visitor
Frequent Visitor

Re: Cant authenticate as a user with Postman (400 error)

AFAIK, the sysadmin registered the powerbi app,  then created a normal user and assigning the user as the owner of the registered PowerBI app, and also granting the permission to the app (something I was not able to do when I was the one registering the app).

 

Hope it helps