Forum Discussion

cdemiguel's avatar
cdemiguel
Regular Visitor
7 years ago

power Bi embed dashboard data doesnt appear outside power bi web

Hi,

i have a trouble with PowerBi, last friday i could see all embed pannels with data from my powerbi in my website,

today, i dunno why, i can't see the data but pannels are displaying, if i enter in powerbi online editor i can see it correctly,

 

outsideweb:

https://imgur.com/a/KmTvqIe

 

 

inside powerbi:

https://imgur.com/a/Cw9dLrv

 

 

 

i am not detecting any problem,

why is this happening?

thanks!!

 

rewards,

 

6 Replies

  • TedPattison's avatar
    TedPattison
    Microsoft Employee

    How are you embedding the dashboard?

     

    Do you have an application that is able to refresh the access token (or embed token) when the page is refreshed?

     

    Or did you possibly hardcode an access token or embed token into the page to implement Power BI embedding? If so, an embed token or access token will exprise after an hour.

    • cdemiguel's avatar
      cdemiguel
      Regular Visitor

      Hi, 

      i 'm refreshing access token in my dashboard every 59 minutes and also when my application is starting,

       

      Generating credentials and accestoken in backend with c# and embeding it with javascript.

       

      c# service

      var credential = new UserPasswordCredential(User, Password);

      // Authenticate using created credentials
      var authenticationContext = new AuthenticationContext(AuthorityUrl);
      var authenticationResult = await authenticationContext.AcquireTokenAsync(ResourceUrl, ClientId, credential);

       

      var tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");

      var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials);

      var dashboards = await client.Dashboards.GetDashboardsInGroupAsync(GroupId);

      var dashboard = dashboards.Value.FirstOrDefault(x => x.Id == DashboardId);

      var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");

      var tokenResponse = await client.Dashboards.GenerateTokenInGroupAsync(GroupId, dashboard.Id, generateTokenRequestParameters);

      var embedConfig = new EmbedConfig
      {
      EmbedToken = tokenResponse,
      EmbedUrl = dashboard.EmbedUrl,
      Id = dashboard.Id
      };

      return embedConfig;

       

      javascript:

      var models = window['powerbi-client'].models;
      var permissions = models.Permissions.All;

      var config = {
      type: 'dashboard',
      tokenType: models.TokenType.Embed,
      accessToken: data.EmbedToken.Token,
      embedUrl: data.EmbedUrl,
      id: data.Id,
      permissions: permissions,
      settings: {
      filterPaneEnabled: true,
      navContentPaneEnabled: true
      }
      };

      var dashboardContainer = $('#embbedDashboard')[0];

      dashboard = powerbi.embed(dashboardContainer, config);

      dashboard.off("loaded");

       

      • TedPattison's avatar
        TedPattison
        Microsoft Employee

        Does the dashboard show correctly when you refresh the page with the dashboard?

         

        You code is accessing the first dashboard in the target workspace. Is it possible you added a new dashbaord which is being access instead of the dashboard you had last Friday?

  • laurenta's avatar
    laurenta
    Frequent Visitor

    Hi,

     

    It seems from the screenshot that you are using streaming tiles. Is it correct?

    There was a bug with streaming tiles on dashboard embedded scenarios at the date of your post and it should be fixed now.

    Are you still encountering the issue?