<?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: Auto Sign-in to Embed Power BI report in web application in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/227427#M7172</link>
    <description>&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Auto Sign-in means user doesn't need to login into POWER BI Azure site.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my complete code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;string redirectUri = String.Format("{0}Redirect.aspx", Properties.Settings.Default.RedirectUrl);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;string authorityUri = Properties.Settings.Default.AADAuthorityUri;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;// Get the auth code&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;string code = Request.Params.GetValues(0)[0];&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;// Get auth token from auth code &lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;TokenCache TC = new TokenCache();&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;AuthenticationContext AC = new AuthenticationContext(authorityUri, TC);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;ClientCredential cc = new ClientCredential(Properties.Settings.Default.ClientID,Properties.Settings.Default.ClientSecret);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;AuthenticationResult AR = AC.AcquireTokenByAuthorizationCode(code, new Uri(redirectUri), cc);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Session[PowerBI.authResultString] = AR;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Response.Redirect("~/PowerBI.aspx", false);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly suggest!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Kavita&lt;/P&gt;</description>
    <pubDate>Tue, 08 Aug 2017 09:50:42 GMT</pubDate>
    <dc:creator>kavitakashish83</dc:creator>
    <dc:date>2017-08-08T09:50:42Z</dc:date>
    <item>
      <title>Auto Sign-in to Embed Power BI report in web application</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/227158#M7166</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to show filtered power BI reports in a web application. But I need to auto sign-in using c# to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;AZURE ACTIVE DIRECTORY to access power BI reports&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my ACTIVE DIRECTORY PATH :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="" href="https://login.windows.net/common/oauth2/authorize/?response_type=code&amp;amp;client_id=" target="_blank" rel="nofollow noopener noreferrer"&gt;https://login.windows.net/common/oauth2/authorize/?response_type=code&amp;amp;client_id=&lt;/A&gt;{&lt;STRONG&gt;Client ID&lt;/STRONG&gt;}&amp;amp;resource=https%3a%2f%2fanalysis.windows.net%2fpowerbi%2fapi&amp;amp;redirect_uri=http%3a%2f%2flocalhost%3a49898%2fRedirect.aspx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions/comment/ solution on this would be highly appreaciated?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Kavita&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 05:28:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/227158#M7166</guid>
      <dc:creator>kavitakashish83</dc:creator>
      <dc:date>2017-08-08T05:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Sign-in to Embed Power BI report in web application</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/227279#M7168</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/38200"&gt;@kavitakashish83&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;What do you mean auto sign-in here?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The URL in your post would redirect you to the redirect_uri appending a &lt;STRONG&gt;code&lt;/STRONG&gt; in the url.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/53729i1F4787DF3E92907F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in next step, you can send a&amp;nbsp;&lt;STRONG&gt;POST&lt;/STRONG&gt; request with the code above and get the access token.&lt;/P&gt;
&lt;PRE&gt;POST /common/oauth2/token HTTP/1.1
Host: login.windows.net
Content-Type: application/x-www-form-urlencoded  

client_secret={client_secrect}&amp;amp;client_id={client_id}&amp;amp;grant_type=authorization_code&amp;amp;resource=https://analysis.windows.net/powerbi/api&amp;amp;redirect_uri={your redirect url}&amp;amp;code={code from above}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 07:34:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/227279#M7168</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-08-08T07:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Sign-in to Embed Power BI report in web application</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/227427#M7172</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Auto Sign-in means user doesn't need to login into POWER BI Azure site.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my complete code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;string redirectUri = String.Format("{0}Redirect.aspx", Properties.Settings.Default.RedirectUrl);&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;string authorityUri = Properties.Settings.Default.AADAuthorityUri;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;// Get the auth code&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;string code = Request.Params.GetValues(0)[0];&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;// Get auth token from auth code &lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;TokenCache TC = new TokenCache();&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;AuthenticationContext AC = new AuthenticationContext(authorityUri, TC);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;ClientCredential cc = new ClientCredential(Properties.Settings.Default.ClientID,Properties.Settings.Default.ClientSecret);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;AuthenticationResult AR = AC.AcquireTokenByAuthorizationCode(code, new Uri(redirectUri), cc);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Session[PowerBI.authResultString] = AR;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Response.Redirect("~/PowerBI.aspx", false);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly suggest!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Kavita&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 09:50:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/227427#M7172</guid>
      <dc:creator>kavitakashish83</dc:creator>
      <dc:date>2017-08-08T09:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Sign-in to Embed Power BI report in web application</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/228283#M7192</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/38200"&gt;@kavitakashish83&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then see this demo &lt;A href="https://github.com/Microsoft/PowerBI-Developer-Samples/blob/master/App%20Owns%20Data/PowerBIEmbedded_AppOwnsData/Controllers/HomeController.cs" target="_self"&gt;APP OWNS DATA&lt;/A&gt;. On license aspect, do note this approach would need Power BI premium license if you'd share your report to the users without Power BI account.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;           // Create a user password cradentials.
            var credential = new UserPasswordCredential(Username, Password);

            // Authenticate using created credentials
            var authenticationContext = new AuthenticationContext(AuthorityUrl);
            var authenticationResult = await authenticationContext.AcquireTokenAsync(ResourceUrl, ClientId, credential);
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 09:49:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/228283#M7192</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-08-09T09:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Sign-in to Embed Power BI report in web application</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/576163#M17770</link>
      <description>&lt;P&gt;How to do same thing in .net core web api?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 09:34:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/576163#M17770</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-30T09:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Sign-in to Embed Power BI report in web application</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/1829970#M29330</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Kavita,&lt;BR /&gt;&lt;BR /&gt;Where Can I write this script? Because I am facing same probelm with login. Is it possible only in power bi permium verion?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Pooja&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 11:30:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Auto-Sign-in-to-Embed-Power-BI-report-in-web-application/m-p/1829970#M29330</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-07T11:30:47Z</dc:date>
    </item>
  </channel>
</rss>

