<?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 Re: Post Request Embed Token in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Post-Request-Embed-Token/m-p/232573#M7331</link>
    <description>&lt;P&gt;I actually was able to figure it out with the help of a Microsoft &lt;A href="https://microsoft.github.io/techcasestudies/power%20bi%20embedded/2017/01/11/Hogarth-Zonza-PBIE.html" target="_self"&gt;Case Study&lt;/A&gt;&amp;nbsp;I found.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You don't need any kind of API for the embed token itself, you can build the JWT outright if you already have an access key.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;import time
import jwt

def generate_token(access_key, workspace_id, report_id, workspace_collection, brand):
    """Generate JWT token."""
    # token times
    start = time.time()
    end = start + 60 * 60

    # create tokens
    headers = {
        "typ": "JWT",
        "alg": "HS256",
}
    payload = {
        "wid": workspace_id,
        "rid": report_id,
        "wcn": workspace_collection,
        "username": VALID USERNAME,
        "roles": [ROLE1, ROLE2, ETC],
        "iss": "PowerBISDK",
        "ver": "0.2.0",
        "aud": "https://analysis.windows.net/powerbi/api",
        "nbf": start,
        "exp": end,
    }
    return jwt.encode(key=access_key, headers=headers, payload=payload)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Aug 2017 16:11:57 GMT</pubDate>
    <dc:creator>adamwallace3</dc:creator>
    <dc:date>2017-08-16T16:11:57Z</dc:date>
    <item>
      <title>Post Request Embed Token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Post-Request-Embed-Token/m-p/231848#M7315</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling to adapt any of the&amp;nbsp;example code to silently get an embed token. My web app is built on the Django framework with an app owns data model (with RLS).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a POST/GET solution&amp;nbsp;that is similar to the the CLI tool that I can use? Or is it possible to build an embed token outright?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am sorry if I this is a silly question, I am quite new to Python and Web apps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 20:28:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Post-Request-Embed-Token/m-p/231848#M7315</guid>
      <dc:creator>adamwallace3</dc:creator>
      <dc:date>2017-08-15T20:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Post Request Embed Token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Post-Request-Embed-Token/m-p/232170#M7321</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/33078"&gt;@adamwallace3&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am struggling to adapt any of the&amp;nbsp;example code to silently get an embed token. My web app is built on the Django framework with an app owns data model (with RLS).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a POST/GET solution&amp;nbsp;that is similar to the the CLI tool that I can use? Or is it possible to build an embed token outright?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am sorry if I this is a silly question, I am quite new to Python and Web apps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/33078"&gt;@adamwallace3&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use below POST REST API to get the access Bearer token.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;POST /common/oauth2/token HTTP/1.1
Host: login.windows.net
Cache-Control: no-cache 
Content-Type: application/x-www-form-urlencoded

client_id={client_id}&amp;amp;grant_type=&lt;STRONG&gt;password&lt;/STRONG&gt;&amp;amp;resource=https://analysis.windows.net/powerbi/api&amp;amp;username={powerbi account}&amp;amp;password={powerbi account password}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then use this API&amp;nbsp;&lt;A href="https://msdn.microsoft.com/en-us/library/mt784614.aspx" target="_self"&gt;GenerateToken&lt;/A&gt;&amp;nbsp;to get embedded token for dashboards/reports/datasets. Note that it seems the RLS now is only avalaible for embedded reports not for dashboards. See this &lt;A href="https://community.powerbi.com/t5/Developer/Power-Bi-Embedded-RLS-with-REST-API/m-p/231540#M7300" target="_self"&gt;thread&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, when using App Owns data, &lt;A href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embedding-content/#step-3-promote-your-solution-to-production" target="_self"&gt;you'll have to purchase Power BI Premium license when promoting your solution to production.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2017 07:16:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Post-Request-Embed-Token/m-p/232170#M7321</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-08-16T07:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Post Request Embed Token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Post-Request-Embed-Token/m-p/232573#M7331</link>
      <description>&lt;P&gt;I actually was able to figure it out with the help of a Microsoft &lt;A href="https://microsoft.github.io/techcasestudies/power%20bi%20embedded/2017/01/11/Hogarth-Zonza-PBIE.html" target="_self"&gt;Case Study&lt;/A&gt;&amp;nbsp;I found.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You don't need any kind of API for the embed token itself, you can build the JWT outright if you already have an access key.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;import time
import jwt

def generate_token(access_key, workspace_id, report_id, workspace_collection, brand):
    """Generate JWT token."""
    # token times
    start = time.time()
    end = start + 60 * 60

    # create tokens
    headers = {
        "typ": "JWT",
        "alg": "HS256",
}
    payload = {
        "wid": workspace_id,
        "rid": report_id,
        "wcn": workspace_collection,
        "username": VALID USERNAME,
        "roles": [ROLE1, ROLE2, ETC],
        "iss": "PowerBISDK",
        "ver": "0.2.0",
        "aud": "https://analysis.windows.net/powerbi/api",
        "nbf": start,
        "exp": end,
    }
    return jwt.encode(key=access_key, headers=headers, payload=payload)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2017 16:11:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Post-Request-Embed-Token/m-p/232573#M7331</guid>
      <dc:creator>adamwallace3</dc:creator>
      <dc:date>2017-08-16T16:11:57Z</dc:date>
    </item>
  </channel>
</rss>

