Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
My requirement is to use the PowerBI embedded to show the .pbix reports in a angular web application.
I'm getting the following error when I try to run this app (https://github.com/guyinacube/Embed-API-Sample) to create Embed token (as specified in the video https://www.youtube.com/watch?v=GPHHdDRSlis&list=PLv2BtOtLblH2Rm9trJPuxmN8Kr8WFv7O0&index=7). The console application is crashing when it is trying to authenticate the credentials.
{"AADSTS70002: The request body must contain the following parameter: 'client_secret or client_assertion'.\r\nTrace ID: 4de61335-1397-4912-ba59-62986ddc6200\r\nCorrelation ID: c7a41f92-4279-45c5-8ecf-f67dbb85d225\r\nTimestamp: 2018-04-23 15:20:09Z"}
It is breaking with the above exception when it executes the line
authenticationResult = await authenticationContext.AcquireTokenAsync(resourceUrl, Secrets.ClientID, credential);
I Registered my application with the Power BI App Registration Tool in the link https://dev.powerbi.com/apps
I provided the following details during registration:
App Type: Server-side Web app Redirect URL: http://localhost:4200/main/homepage Home Page URL: http://localhost:4200
After registering the application with above details, I got both Client ID & Client Secret. In the console I could provide the ClientID, my login credentials, but not able to provide Client Secret. When I execute the application and during the authentication the application is crashing.
Why I am getting this error? How to generate the Embed token?
It sounds like the request you're making has the wrong body.
To manually get an access key, see this thread for details on how to get the token using the REST API.
Or follow my example using Postman (free tool, use a search engine to find it).
In the body, fill in the client_id, username and password field with your values. For grant_type, scope and resource, copy the values in my screenshot or from the link above. Make sure POST is selected and the URL is https://login.microsoftonline.com/common/oauth2/token
Thanks for your reply. I tried following both the approaches specified by you, but both doesn't seem to work for me. not sure what is the mistake I am doing it here?
approach1: I tried calling the RestAPI service using the Restlet from chrome browser with the following data. https://login.microsoftonline.com/common/oauth2/token
{
grant_type: password
scope: openid
resource: https://analysis.windows.net/powerbi/api
client_id: ********************
username: ********************
password: ********************
}
But I am getting the error as follows:
{
"error": "invalid_request",
"error_description": "AADSTS90014: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: dea02939-adaf-44ad-9395-00dc9ba89f00\r\nCorrelation ID: d5b77411-5b4f-4858-8afd-1009ad5da0cb\r\nTimestamp: 2018-04-25 15:00:26Z",
"error_codes":[
90014
],
"timestamp": "2018-04-25 15:00:26Z",
"trace_id": "dea02939-adaf-44ad-9395-00dc9ba89f00",
"correlation_id": "d5b77411-5b4f-4858-8afd-1009ad5da0cb"
}
Approach2: With the same input data and the same RestAPI url, I tried it in Postman, but I am getting different error.
{
"error": "invalid_grant",
"error_description": "AADSTS70002: Error validating credentials. AADSTS50056: Password does not exist in store for this user\r\nTrace ID: 57573138-e630-4813-a722-a198e5997000\r\nCorrelation ID: 46099d23-a758-446c-8b91-ed18d3b8949a\r\nTimestamp: 2018-04-25 14:54:03Z",
"error_codes": [
70002,
50056
],
"timestamp": "2018-04-25 14:54:03Z",
"trace_id": "57573138-e630-4813-a722-a198e5997000",
"correlation_id": "46099d23-a758-446c-8b91-ed18d3b8949a"
}
Please let me know what is the mistake here?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
4 | |
3 | |
3 | |
3 | |
3 |