title: Create Report in Embed View via PowerBI API
body: <p>I am trying to create a new report from a dataset in an embedded view. However, I keep getting "This content isn't available" and the reportEmbed.min.js returning a 403 on render. Within app.powerbi.com I can successfully create and save reports, but as mentioned above the embedded view is not working.</p>
  
  <p>I am following this documentation exactly:
  <a href="https://github.com/Microsoft/PowerBI-JavaScript/wiki/Create-Report-in-Embed-View" rel="nofollow noreferrer">https://github.com/Microsoft/PowerBI-JavaScript/wiki/Create-Report-in-Embed-View</a></p>
  
  <p>However, I am generating my embed token via a Power BI API call as documentation allows here:
  <a href="https://msdn.microsoft.com/en-us/library/mt784614.aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/mt784614.aspx</a></p>
  
  <p>Here is my server-side, embedToken generation code:</p>
  
  <pre><code>const createReportEmbedTokenForCreation = ({
    accessToken,
    groupId,
    datasetId,
  }) =&gt;
    new Promise((resolve, reject) =&gt; {
      const url = `https://api.powerbi.com/v1.0/myorg/groups/${groupId}/reports/GenerateToken`;
      const headers = {
      'Content-Type': 'application/x-www-form-urlencoded',
      Authorization: `Bearer ${accessToken}`,
    };
    const form = {
      accessLevel: 'Create',
      datasetId,
      allowSaveAs: true,
    };
    request.post({ url, form, headers }, (err, result, body) =&gt; {
      if (err) return reject(err);
      const bodyObj = JSON.parse(body);
      if (bodyObj.error) return reject(new Error(body));
      return resolve(bodyObj.token);
    });
  });
  </code></pre>
  
  <p>Here is my client-side embed code:</p>
  
  <pre><code>const config = {
    accessToken: embedToken,
    embedUrl: 'https://embedded.powerbi.com/appTokenReportEmbed',
    datasetId: defaultReport.datasetId,
  };
  const report = powerbi.createReport(
    document.getElementById('ReportEmbed'),
    config,
  );
  </code></pre>
  
  <p>Am I missing some scope some where?</p>
  
  <p>Thanks in advance!</p>