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

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.

Reply
amol9372
Regular Visitor

Power Bi embedded in User owns data on a webapp deployed on local server

Whenever i am trying to embed my Power Bi report into my webapp deployed on a local server , i am getting 403 error

I am using the below code to get access token

 

 

var config = {
    tenant: 'tenant id here',
    clientId: 'client id here',
    redirectUri: 'http://localhost:8080/PowerBiApp',
    navigateToLoginRequestUrl:false,

};

var authContext=new AuthenticationContext(config);

var hash = window.location.hash;

if(hash.length!=0){
    authContext.handleWindowCallback(hash);
    var user=authContext.getCachedUser();
}
    

function login(){
    authContext.login();
}

function acqureToken(){
    authContext.acquireToken("https://graph.microsoft.com", function(error, token, message){
        console.log(token)

    })
}

 

 

After that i am usng this token to embed the report, below is the code to embed the report

 

 

 window.onload = function () {

        var embedConfiguration = {
            type: 'report',
            accessToken: 'token here',        
           embedUrl: 'https://embedded.powerbi.com/appTokenReportEmbed?reportId=feb96c19-cad7-478a-934d-2e647f98a4ff' 
       };

        var $reportContainer = $('#reportContainer');

        var report = powerbi.embed($reportContainer.get(0), embedConfiguration);

        report.fullscreen();

    }

 

but i am always getting 403 error

Can someone help ?

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

Hi amol9372,

 

Seems like something wrong with the authentication, please check if the access token is expired, also check if the app workspace has been assigned to a capacity. For more details, please refer to: https://docs.microsoft.com/en-us/power-bi/developer/embed-sample-for-customers#create-a-dedicated-ca....

 

Regards,

Jimmy Tao

View solution in original post

1 REPLY 1
v-yuta-msft
Community Support
Community Support

Hi amol9372,

 

Seems like something wrong with the authentication, please check if the access token is expired, also check if the app workspace has been assigned to a capacity. For more details, please refer to: https://docs.microsoft.com/en-us/power-bi/developer/embed-sample-for-customers#create-a-dedicated-ca....

 

Regards,

Jimmy Tao

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.