<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create Report in Embed View via Power BI API in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Create-Report-in-Embed-View-via-Power-BI-API/m-p/371905#M11088</link>
    <description>&lt;P&gt;I am trying to create a new report from a dataset in an embedded view. However, I&amp;nbsp;keep getting "&lt;SPAN&gt;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&amp;nbsp;above the embedded view is not working.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am following this documentation exactly:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Microsoft/PowerBI-JavaScript/wiki/Create-Report-in-Embed-View" target="_blank"&gt;https://github.com/Microsoft/PowerBI-JavaScript/wiki/Create-Report-in-Embed-View&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I am generating my embed token via a Power BI API call as documentation allows here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://msdn.microsoft.com/en-us/library/mt784614.aspx" target="_blank"&gt;https://msdn.microsoft.com/en-us/library/mt784614.aspx&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my server-side, embedToken generation code:&lt;/P&gt;&lt;PRE&gt;const createReportEmbedTokenForCreation = ({
  accessToken,
  groupId,
  datasetId,
}) =&amp;gt;
  new Promise((resolve, reject) =&amp;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) =&amp;gt; {
      if (err) return reject(err);
      const bodyObj = JSON.parse(body);
      if (bodyObj.error) return reject(new Error(body));
      return resolve(bodyObj.token);
    });
  });&lt;/PRE&gt;&lt;P&gt;Here is my client-side embed code:&lt;/P&gt;&lt;PRE&gt;const config = {
  accessToken: embedToken,
  embedUrl: 'https://embedded.powerbi.com/appTokenReportEmbed',
  datasetId: defaultReport.datasetId,
};
const report = powerbi.createReport(
  document.getElementById('ReportEmbed'),
  config,
);&lt;/PRE&gt;&lt;P&gt;Am I missing some scope some where?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Thu, 08 Mar 2018 01:01:51 GMT</pubDate>
    <dc:creator>jawarren</dc:creator>
    <dc:date>2018-03-08T01:01:51Z</dc:date>
    <item>
      <title>Create Report in Embed View via Power BI API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-Report-in-Embed-View-via-Power-BI-API/m-p/371905#M11088</link>
      <description>&lt;P&gt;I am trying to create a new report from a dataset in an embedded view. However, I&amp;nbsp;keep getting "&lt;SPAN&gt;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&amp;nbsp;above the embedded view is not working.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am following this documentation exactly:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Microsoft/PowerBI-JavaScript/wiki/Create-Report-in-Embed-View" target="_blank"&gt;https://github.com/Microsoft/PowerBI-JavaScript/wiki/Create-Report-in-Embed-View&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I am generating my embed token via a Power BI API call as documentation allows here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://msdn.microsoft.com/en-us/library/mt784614.aspx" target="_blank"&gt;https://msdn.microsoft.com/en-us/library/mt784614.aspx&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my server-side, embedToken generation code:&lt;/P&gt;&lt;PRE&gt;const createReportEmbedTokenForCreation = ({
  accessToken,
  groupId,
  datasetId,
}) =&amp;gt;
  new Promise((resolve, reject) =&amp;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) =&amp;gt; {
      if (err) return reject(err);
      const bodyObj = JSON.parse(body);
      if (bodyObj.error) return reject(new Error(body));
      return resolve(bodyObj.token);
    });
  });&lt;/PRE&gt;&lt;P&gt;Here is my client-side embed code:&lt;/P&gt;&lt;PRE&gt;const config = {
  accessToken: embedToken,
  embedUrl: 'https://embedded.powerbi.com/appTokenReportEmbed',
  datasetId: defaultReport.datasetId,
};
const report = powerbi.createReport(
  document.getElementById('ReportEmbed'),
  config,
);&lt;/PRE&gt;&lt;P&gt;Am I missing some scope some where?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 01:01:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-Report-in-Embed-View-via-Power-BI-API/m-p/371905#M11088</guid>
      <dc:creator>jawarren</dc:creator>
      <dc:date>2018-03-08T01:01:51Z</dc:date>
    </item>
    <item>
      <title>Create Report in Embed View via PowerBI API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-Report-in-Embed-View-via-Power-BI-API/m-p/371908#M11136</link>
      <description>&lt;P&gt;I am trying to create a new report from a dataset in an embedded view. However, I&amp;nbsp;keep getting&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"&lt;SPAN&gt;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&amp;nbsp;above the embedded view is not working.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am following this documentation exactly:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Microsoft/PowerBI-JavaScript/wiki/Create-Report-in-Embed-View" target="_blank"&gt;https://github.com/Microsoft/PowerBI-JavaScript/wiki/Create-Report-in-Embed-View&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I am generating my embed token via a Power BI API call as documentation allows here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://msdn.microsoft.com/en-us/library/mt784614.aspx" target="_blank"&gt;https://msdn.microsoft.com/en-us/library/mt784614.aspx&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my server-side, embedToken generation code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;const createReportEmbedTokenForCreation = ({
  accessToken,
  groupId,
  datasetId,
}) =&amp;gt;
  new Promise((resolve, reject) =&amp;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) =&amp;gt; {
      if (err) return reject(err);
      const bodyObj = JSON.parse(body);
      if (bodyObj.error) return reject(new Error(body));
      return resolve(bodyObj.token);
    });
  });&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my client-side embed code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;const config = {
  accessToken: embedToken,
  embedUrl: 'https://embedded.powerbi.com/appTokenReportEmbed',
  datasetId: defaultReport.datasetId,
};
const report = powerbi.createReport(
  document.getElementById('ReportEmbed'),
  config,
);&lt;/PRE&gt;&lt;P&gt;Am I missing some scope some where?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 04:52:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-Report-in-Embed-View-via-Power-BI-API/m-p/371908#M11136</guid>
      <dc:creator>jawarren</dc:creator>
      <dc:date>2018-03-08T04:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create Report in Embed View via Power BI API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-Report-in-Embed-View-via-Power-BI-API/m-p/373978#M11137</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/57235"&gt;@jawarren&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Developer/403-Forbidden-error-occured-when-using-REST-API/td-p/71005/page/2" target="_self"&gt;Here&lt;/A&gt; is a similar thread in which some troubleshooting steps are mentioned. Could you go to check if it helps in your scenario?&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.fabric.microsoft.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Power BI has a tile embed sample, which I verified works correctly with interactive user login. Note, that when you're using Power BI.com, the user needs to be an AAD user and needs to login as themselves for licensing reason. &amp;nbsp;As someone alluded to in another comment if you want to not use AAD users, you'd use Power BI Embedded, which doesn't require the end user to be an AAD user.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A title="" href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttps-3A__powerbi.microsoft.com_en-2Dus_documentation_powerbi-2Ddeveloper-2Dintegrate-2Dtile_%26d%3DDwMFAg%26c%3Dfa_WZs7nNMvOIDyLmzi2sMVHyyC4hN9WQl29lWJQ5Y4%26r%3DlziRHguINJltMuH2_R-xlJMtQq9UK3TMda5s7p98pRA%26m%3DE3Tu5xEBa_SDbCwVIMjkyu_Ge_hwEvXostawbPkV5BU%26s%3Das-2eobfURiyRdjtQxW6KDU6Kd4Wlzt4zUBfzz8YOq8%26e%3D&amp;amp;data=02%7C01%7Clukaszp%40microsoft.com%7C3a553545229a40d2ceab08d486aa4a2d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636281513325137264&amp;amp;sdata=Uc2IY0wTQaqL5VvnzKuqrUHWTVo2F5WkvyTOZ4mTIZ0%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-integrate-tile/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you use your client ID and secret with the above sample and see if it works. &amp;nbsp;Make sure the application has the following redirect URL configured:&lt;/P&gt;
&lt;P&gt;“&lt;A title="" href="http://localhost:13526/" target="_blank" rel="nofollow noopener noreferrer"&gt;Http://localhost:13526/&lt;/A&gt;”&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Usually, you get a 403 when the application does not have appropriate permissions. Remember that if you added permissions (scopes) to the application AFTER the user trusted the application, the user’s token won’t get the new scopes until they remove trust from the application and trust it again. Easiest workaround is to create a new application and use that instead. &amp;nbsp;Alternative is to manually remove the application using Office 365’s “my apps” feature and then try to use the application again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might also draw inspiration from several other similar threads from other services:&lt;/P&gt;
&lt;P&gt;&lt;A title="" href="http://stackoverflow.com/questions/31735264/403-forbidden-from-azure-graph-api" target="_blank" rel="nofollow noopener noreferrer"&gt;http://stackoverflow.com/questions/31735264/403-forbidden-from-azure-graph-api&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A title="" href="https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-integrating-applications#BKMK_Updating" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-integrating-applica...&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A title="" href="https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-developers-guide" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-developers-guide&lt;/A&gt;&lt;/P&gt;
&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 06:29:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-Report-in-Embed-View-via-Power-BI-API/m-p/373978#M11137</guid>
      <dc:creator>v-ljerr-msft</dc:creator>
      <dc:date>2018-03-12T06:29:16Z</dc:date>
    </item>
  </channel>
</rss>

