<?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: Utilizing RLS tokens in non-.NET app in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Utilizing-RLS-tokens-in-non-NET-app/m-p/443292#M13669</link>
    <description>&lt;P&gt;Thanks for the response! I'm working on implementing some configuration you mentioned. We have always been using the JS library you mentioned, so we're on the same page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the purpose of "tokenType"?&amp;nbsp;&lt;BR /&gt;We are in an app-owns-data scenario, btw.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jun 2018 13:26:28 GMT</pubDate>
    <dc:creator>droe1</dc:creator>
    <dc:date>2018-06-19T13:26:28Z</dc:date>
    <item>
      <title>Utilizing RLS tokens in non-.NET app</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Utilizing-RLS-tokens-in-non-NET-app/m-p/441105#M13598</link>
      <description>&lt;P&gt;We have been using PowerBI Pro successfully for a while now in an ISV scenario. Our app owns the data, and we are embedding reports. We have a DataGateway connected to an on-premise MySQL server. We want to begin using RLS. Our app is in PHP; we can't utilize .NET code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have no trouble obtaining an RLS token. (We&amp;nbsp;cleared those barriers.) We can submit username and role information as demonstrated in the API docs. We can get back a token via the GenerateToken endpoint of the API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once we have this token in hand, how do we use it? I assumed that we could feed it into the JavaScript library (Microsoft) much as we did with our auth token. However, this gives a "403 Forbidden" error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thus my question is:&amp;nbsp;I've managed to fetch an RLS-augmented token via the API. Now (without .NET), how do I utilize the token?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 19:03:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Utilizing-RLS-tokens-in-non-NET-app/m-p/441105#M13598</guid>
      <dc:creator>droe1</dc:creator>
      <dc:date>2018-06-15T19:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Utilizing RLS tokens in non-.NET app</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Utilizing-RLS-tokens-in-non-NET-app/m-p/442884#M13659</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/46561"&gt;@droe1&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you have gotten the token, the rest steps could be finished by your own application. Maybe you can embed the contents with powerbi-client-JS package. Please refer to&amp;nbsp;&lt;A href="https://github.com/Microsoft/PowerBI-JavaScript" target="_self"&gt;https://github.com/Microsoft/PowerBI-JavaScript&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Below is a demo that is a single html page with all the JS scripts.&lt;/P&gt;
&lt;PRE&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
	&amp;lt;title&amp;gt;
		Embed in a single page Test
	&amp;lt;/title&amp;gt;
	&amp;lt;style&amp;gt;
        div {
            height: 680px;
            width: 320px;
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;script&amp;gt;
window.onload = function() {
// your token
    var txtAccessToken = "Your token";

// Read embed URL from textbox
var txtEmbedUrl = "https://app.powerbi.com/reportEmbed?reportId=a873e468-a5215950b&amp;amp;groupId=70cdd6cb98ed9b65";

// Read report Id from textbox
var txtEmbedReportId = "a873e461215950b";

// Read embed type from radio
//var tokenType = "AAD token"; 0: AAD token, 1: embed token.
    var tokenType = 1;
    
// Get models. models contains enums that can be used.
var models = window['powerbi-client'].models;

// We give All permissions to demonstrate switching between View and Edit mode and saving report.
var permissions = models.Permissions.All;

// Embed configuration used to describe the what and how to embed.
// This object is used when calling powerbi.embed.
// This also includes settings and options such as filters.
// You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
var config= {
    type: 'report',
    tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
    accessToken: txtAccessToken,
    embedUrl: txtEmbedUrl,
    id: txtEmbedReportId,
    permissions: permissions,
    settings: {
        layoutType: models.LayoutType.MobilePortrait
    }
};

// Get a reference to the embedded report HTML element
var embedContainer = $('#container')[0];



    var report = powerbi.load(embedContainer, config);

    report.on("loaded", function () {
        report.render(config);
    });

report.on("error", function(event) {
    Log.log(event.detail);

    report.off("error");
});

report.off("saved");
report.on("saved", function(event) {
    Log.log(event.detail);
    if(event.detail.saveAs) {
        Log.logText('In order to interact with the new report, create a new token and load the new report');
     }
 })
 }
 &amp;lt;/script&amp;gt;
 &amp;lt;script src="../node_modules/jquery/dist/jquery.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="../node_modules/es6-promise/dist/es6-promise.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="../node_modules/powerbi-client/dist/powerbi.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="scripts/codesamples.js"&amp;gt;&amp;lt;/script&amp;gt;   
    &amp;lt;script src="scripts/index.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="scripts/utils.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="scripts/logger.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="scripts/session_utils.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="scripts/function_mapping.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="scripts/report.js"&amp;gt;&amp;lt;/script&amp;gt;  
    &amp;lt;script src="scripts/step_samples.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="scripts/step_embed.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="scripts/step_interact.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;div id = "container"&amp;gt;&amp;lt;/div&amp;gt;

 &amp;lt;/body&amp;gt;
 &amp;lt;/html&amp;gt;&lt;/PRE&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Dale&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 06:18:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Utilizing-RLS-tokens-in-non-NET-app/m-p/442884#M13659</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-06-19T06:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Utilizing RLS tokens in non-.NET app</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Utilizing-RLS-tokens-in-non-NET-app/m-p/443292#M13669</link>
      <description>&lt;P&gt;Thanks for the response! I'm working on implementing some configuration you mentioned. We have always been using the JS library you mentioned, so we're on the same page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the purpose of "tokenType"?&amp;nbsp;&lt;BR /&gt;We are in an app-owns-data scenario, btw.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 13:26:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Utilizing-RLS-tokens-in-non-NET-app/m-p/443292#M13669</guid>
      <dc:creator>droe1</dc:creator>
      <dc:date>2018-06-19T13:26:28Z</dc:date>
    </item>
  </channel>
</rss>

