Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I’m trying to integrate Power BI into my application. I’m trying to get access token from Azure directory using my Acure account.
One of MS Employee has uploaded this code. I just updated configurations (clientID) and it’s not working
https://github.com/guyinacube/Embed-API-Sample
I’ve also tried this code but have the same issue
https://github.com/Microsoft/PowerBI-Developer-Samples
{"error":"invalid_grant","error_description":"AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password\r\nTrace ID: 4aa2b383-6a83-4052-91f0-021a8ff72300\r\nCorrelation ID: 25b0177d-8cd1-457f-9909-87f1f8a0b8bc\r\nTimestamp: 2017-11-13 14:41:58Z","error_codes":[70002,50126],"timestamp":"2017-11-13 14:41:58Z","trace_id":"4aa2b383-6a83-4052-91f0-021a8ff72300","correlation_id":"25b0177d-8cd1-457f-9909-87f1f8a0b8bc"}: Unknown error
Solved! Go to Solution.
@mahmoodtahir wrote:
Hi, yes it is valid power bi account and azure account (for both portals i've same email address)
if i use "User Owns Data" application, then i can get access token and see dashboards and everything
https://github.com/Microsoft/PowerBI-Developer-Samples
but if i use "App Owns Data" code then i get following error message
{"error":"invalid_client","error_description":"AADSTS70002: The request body must contain the following parameter: 'client_secret or client_assertion'.\r\nTrace ID: 1cd4832f-7748-4e25-92f3-bedc7c871700\r\nCorrelation ID: 2caf178e-af91-4d8d-86ca-2601f6813a0f\r\nTimestamp: 2017-11-15 09:54:08Z","error_codes":[70002],"timestamp":"2017-11-15 09:54:08Z","trace_id":"1cd4832f-7748-4e25-92f3-bedc7c871700","correlation_id":"2caf178e-af91-4d8d-86ca-2601f6813a0f"}: Unknown error
FYI:
If I hard code access token in "App Owns Data" then I can get all reports. As you know I can't hard code token it expires in an hour. (10mins to 1 day validity)
string accessToken = "ACCESS TOKEN";
var tokenCredentials = new TokenCredentials(accessToken, "Bearer");
using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))
{
// Get a list of reports.
var reports = await client.Reports.GetReportsAsync();
}
The error message is different from the error in your original post. In this post, the error indicates that you're using a server-wide application, please register a native app instead.
@mahmoodtahir wrote:
Hi,
I’m trying to integrate Power BI into my application. I’m trying to get access token from Azure directory using my Acure account.
One of MS Employee has uploaded this code. I just updated configurations (clientID) and it’s not working
https://github.com/guyinacube/Embed-API-Sample
I’ve also tried this code but have the same issue
https://github.com/Microsoft/PowerBI-Developer-Samples
{"error":"invalid_grant","error_description":"AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password\r\nTrace ID: 4aa2b383-6a83-4052-91f0-021a8ff72300\r\nCorrelation ID: 25b0177d-8cd1-457f-9909-87f1f8a0b8bc\r\nTimestamp: 2017-11-13 14:41:58Z","error_codes":[70002,50126],"timestamp":"2017-11-13 14:41:58Z","trace_id":"4aa2b383-6a83-4052-91f0-021a8ff72300","correlation_id":"25b0177d-8cd1-457f-9909-87f1f8a0b8bc"}: Unknown error
The error message is intuitive. What is the account and password in your App Owns Data sample? Can you confirem that account is a valid Power BI account?
Hi, yes it is valid power bi account and azure account (for both portals i've same email address)
if i use "User Owns Data" application, then i can get access token and see dashboards and everything
https://github.com/Microsoft/PowerBI-Developer-Samples
but if i use "App Owns Data" code then i get following error message
FYI:
If I hard code access token in "App Owns Data" then I can get all reports. As you know I can't hard code token it expires in an hour. (10mins to 1 day validity)
string accessToken = "ACCESS TOKEN";
var tokenCredentials = new TokenCredentials(accessToken, "Bearer");
using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))
{
// Get a list of reports.
var reports = await client.Reports.GetReportsAsync();
}
@mahmoodtahir wrote:
Hi, yes it is valid power bi account and azure account (for both portals i've same email address)
if i use "User Owns Data" application, then i can get access token and see dashboards and everything
https://github.com/Microsoft/PowerBI-Developer-Samples
but if i use "App Owns Data" code then i get following error message
{"error":"invalid_client","error_description":"AADSTS70002: The request body must contain the following parameter: 'client_secret or client_assertion'.\r\nTrace ID: 1cd4832f-7748-4e25-92f3-bedc7c871700\r\nCorrelation ID: 2caf178e-af91-4d8d-86ca-2601f6813a0f\r\nTimestamp: 2017-11-15 09:54:08Z","error_codes":[70002],"timestamp":"2017-11-15 09:54:08Z","trace_id":"1cd4832f-7748-4e25-92f3-bedc7c871700","correlation_id":"2caf178e-af91-4d8d-86ca-2601f6813a0f"}: Unknown error
FYI:
If I hard code access token in "App Owns Data" then I can get all reports. As you know I can't hard code token it expires in an hour. (10mins to 1 day validity)
string accessToken = "ACCESS TOKEN";
var tokenCredentials = new TokenCredentials(accessToken, "Bearer");
using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))
{
// Get a list of reports.
var reports = await client.Reports.GetReportsAsync();
}
The error message is different from the error in your original post. In this post, the error indicates that you're using a server-wide application, please register a native app instead.
Check this link https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-register-app/
It seems like you didn't Grant Permissions to your app
Regards
Thanks @Juramirez for your reply
If I use "User Owns Data" example then i can access token and able to embed dashboard
but If I use same registered app (in azure) with "App Owns Data" example then i get this issue.
I use AOD and the problem you're getting I solved it doing that. Please be sure you're following all steps in https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embed-sample-app-owns-data/
Did you change your web config parameters?
Regards
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
13 | |
2 | |
2 | |
1 | |
1 |