Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
E-Mac2
Frequent Visitor

Power BI Embedded authentication error

Hi all,

 

I have been trying to run the samples from the following link: https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-integrate-dashboard/

 

I followed the steps, but I get an authentication error in both the 'App owns data' and 'User owns data' samples.

 

In the 'App owns data' sample I get the following error :

 

Operation returned an invalid status code 'Forbidden'

 

on the following line of code: 

var tokenResponse = await client.Reports.GenerateTokenInGroupAsync(GroupId, report.Id, generateTokenRequestParameters);

 

In the 'User owns data' dashboard sample, I get the following error:

 

As I clicked 'Sign in to Power BI' and entered details I received an authentication error 'System.FormatException: 'Index (zero based) must be greater than or equal to zero and less than the size of the argument list.' at AuthenticationResult AR = AC.AcquireTokenByAuthorizationCode(code, new Uri(redirectUri), cc); in redirect.aspx.cs

 

Any help on these would be great, thanks.

 

5 REPLIES 5
Eric_Zhang
Microsoft Employee
Microsoft Employee

@E-Mac2

Please try to follow below steps.

1. Register a new Azure AD app.

2. Go to Azure portal, login with the User used when registering the app. Then find the registered Azure app.

Capture.PNG

 

3.Then edit required permisson, select all checkboxes for Power BI Services and click Save. At last, click Grant Permission and click yes.

Capture2.PNG

Hi @Eric_Zhang

 

Thanks for the reply.

 

I mananged to solve the first problem. I was trying to access a private group using it's ID. I created a new 'open' group. This allowed me to access the report using the group ID.

 

As for the second issue, I tried the above permission changes but the problem still persists 😕

Anonymous
Not applicable

Were you able to resolve the issue with returning a "Forbidden"?  I am working through testing a solution and am now receiving the same error.

 

Whenever the code executes the following line:

 

var tokenResponse = await client.Reports.GenerateTokenInGroupAsync(GroupId, report.Id, generateTokenRequestParameters);

This sample was working with no issues yesterday but this morning now it is returning this error.

Hi @Anonymous

 

Were any of the security settings of the group changed recently?

 

The way I worked around it was by creating a new non-private group and replacing the group ID in the code with the new group ID from the newly created group.

Anonymous
Not applicable

Hmm.

 

I added members to the group but that's all that has changed.  Randomly it started working for a few minutes but now it's returning a forbidden error again.  It seems to me that something is going on with the service that's causing an issue.  I could make the group public but that isn't ideal for security reasons.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.