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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
TransDig
Advocate I
Advocate I

Real time error 401 in embeded scenario

Hi guys,

 

I'm having some trouble with my real time dashboards embeded in our Angular web application. In my case I have some dashboards with real tiime trought Azure stream analitycs. All of the dashboards were working well bout some days ago the refresed of the data in our web stopped. When i open this dashboards in PBI service the real time data is refresed correctly but no in my application and i dont know why exactly.

 

In the developer tools of the browser I find some errors related with the 401 Unauthorized: Error.

TransDig_0-1678190384177.png

 

Maybe the error is related with the module I use to embeded the dashboards in algular called PowerBi-client updated to version 2.22.2.

 

Here is some code that I'm using to embed the dashboard:

 

 

 

const config: IEmbedConfiguration = {
              type: 'dashboard',
              accessToken: accessToken,
              embedUrl: embedUrl,
              id: embedReportId,
              pageView: 'fitToWidth',
              settings: {
                filterPaneEnabled: false,
                hideErrors: true,
                navContentPaneEnabled: this.embedUrls.tabs,
                localeSettings: {
                  language: this.translate.currentLang,
                  formatLocale: this.translate.currentLang.toLowerCase()
                }
              }
            };

            // Grab the reference to the div HTML element that will host the report.
            const reportContainer = <HTMLElement>document.getElementById('DashboardContainer');

            // Embed the report and display it within the div container.
            const powerbi2: service.Service = new service.Service(factories.hpmFactory, factories.wpmpFactory, factories.routerFactory);
            powerbi2.reset(reportContainer);
            this.report = powerbi2.embed(reportContainer, config);

 

 

 

 

Its a very strange error because all the content and the information of the dasboard load perfectly but it doesn't have any refresh after the initial load.

 

Any one know why this error occur?

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi @TransDig ,

According to the error message, it seems that the problem was caused by insufficient privileges. Which authentication method you are using when embedded the report? Service principal or Master user?yingyinr_0-1678343324275.png If you are using service principal, please check if grant the proper access for below steps:

Step 6 - Service principal API access

yingyinr_1-1678343488019.png

Step 7 - Enable workspace access

yingyinr_2-1678343537624.png

 

In addition, the following links are the ones which have the similar problem as yours. Hope their solution can help you solve the problem.

401 Unauthorized: Error while retrieving Embed URL (embed power bi for customers-Python)

Power Bi REST API - 401 Authorization error when using Service Principals

Power BI REST API - 401 Authorization error when using app secret/service principal

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yiruan-msft Thanks a lot for the response.

 

I tried to use one of the samples code provided in Embed content in your Power BI embedded analytics application - Power BI | Microsoft Learn page.

I sucesfully added the Service Principal autentication using a .net scenario but after sucessfully loaded one of our real time dashboards in the demo app the problem is the same. The dashboards (tiles, tables... etc) load perfectly but i cant see the refresh of the dashboard after the initial load. 

 

I dont know where is the problem. Maybe in the power bi service or the app registered on Azure AD. The dashboards in power bi service is working well with the real time data from a push dataset but for any reason I cant see this refresh in a embeded scenario.

 

¿Any ideas?

 

Thanks a lot for the help.

I have the EXACT same problem right now, same error message 401 in an embedded SaaS app that I've built for Power BI customers. Any ideas from anyone? It's like it's an internal problem within Microsoft/Azure or the Javascript SDK files.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.