<?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: Native App for data push with auto login in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/593558#M18073</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/99291"&gt;@amatteo90&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Could you please mark the proper answers as solutions?&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Dale&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jan 2019 07:20:46 GMT</pubDate>
    <dc:creator>v-jiascu-msft</dc:creator>
    <dc:date>2019-01-02T07:20:46Z</dc:date>
    <item>
      <title>Native App for data push with auto login</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/588601#M17956</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I'm building a console application using Visual Studio 2017 in order to&amp;nbsp;push data into a Power BI dataset. I followed this guide:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/walkthrough-push-data" target="_self"&gt;https://docs.microsoft.com/en-us/power-bi/developer/walkthrough-push-data&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Everithing it's working fine but &lt;STRONG&gt;i need to get a token with a non-interactively authentication to Azure AD&lt;/STRONG&gt;. In a few words, without&amp;nbsp;GUI on which user select his username. In internet I can't find anything that explains how to do that with a Native App. I only found how to do that with App Web/API using the clientID and secretID, &lt;STRONG&gt;but with Native App I haven't any secretID&lt;/STRONG&gt;. &lt;EM&gt;Moreover with a App Web/API I got an Unauthorized (401) when I try to create a DataSet.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone could please help me to find a solution? Keep in mind that I&amp;nbsp;&lt;U&gt;never&lt;/U&gt; want the login screen to appear, so the solution of token stored in the cache is useless for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any kind of help. Thanks,&lt;/P&gt;&lt;P&gt;amatteo90&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 14:31:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/588601#M17956</guid>
      <dc:creator>amatteo90</dc:creator>
      <dc:date>2018-12-19T14:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: Native App for data push with auto login</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/588620#M17957</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to do the same thing:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Developer/Power-Bi-REST-API-401-Authorization-error-when-using-app-secret/m-p/588468#M17950" target="_blank"&gt;https://community.powerbi.com/t5/Developer/Power-Bi-REST-API-401-Authorization-error-when-using-app-secret/m-p/588468#M17950&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can't generate an app key when you have selected Native app type. You have to select Web/API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This sample shows you how to use the app secret:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/azure-samples/active-directory-dotnet-daemon" target="_blank"&gt;https://github.com/azure-samples/active-directory-dotnet-daemon&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get 401 errors when I try to call the REST API though. This is even though my app has been granted permissions by a Global Admin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 15:04:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/588620#M17957</guid>
      <dc:creator>tripleacoder</dc:creator>
      <dc:date>2018-12-19T15:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Native App for data push with auto login</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/588640#M17958</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Thanks for the answer, By using a Web App I haven't any problem to perform a login with no GUI for authentication. However I got a 401 error when I try to call the REST API like you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;For Power BI Service I've granted any king of delegate authorizations&lt;/U&gt; that requires no administrator privileges. However I&lt;STRONG&gt;'ve a problem to grant the authorization "Access the directory as the signed-in user" even if doesn't require&amp;nbsp;administrator privileges.&amp;nbsp;&lt;/STRONG&gt;Maybe is this the problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 455px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/137931iC244B741A8172D9B/image-dimensions/455x250?v=v2" width="455" height="250" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 15:17:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/588640#M17958</guid>
      <dc:creator>amatteo90</dc:creator>
      <dc:date>2018-12-19T15:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Native App for data push with auto login</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/588651#M17960</link>
      <description>&lt;P&gt;I am not sure the Delegated permissions are used at all when authenticating using an app key/service principal...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-permissions-and-consent#types-of-permissions" target="_blank"&gt;https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-permissions-and-consent#types-of-permissions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Types of permissions&lt;/H2&gt;&lt;P&gt;Azure AD defines two kinds of permissions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Delegated permissions&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;- Are used by apps that have a signed-in user present. For these apps, either the user or an administrator consents to the permissions that the app requests and the app is delegated permission to act as the signed-in user when making calls to an API. Depending on the API, the user may not be able to consent to the API directly and would instead&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-devhowto-multi-tenant-overview#understanding-user-and-admin-consent" target="_blank"&gt;require an administrator to provide "admin consent"&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Application permissions&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;- Are used by apps that run without a signed-in user present; for example, apps that run as background services or daemons. Application permissions can only be&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes#requesting-consent-for-an-entire-tenant" target="_blank"&gt;consented by an administrator&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;because they are typically powerful and allow access to data across user-boundaries, or data that would otherwise be restricted to administrators.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 19 Dec 2018 15:41:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/588651#M17960</guid>
      <dc:creator>tripleacoder</dc:creator>
      <dc:date>2018-12-19T15:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Native App for data push with auto login</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/591143#M17998</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/99291"&gt;@amatteo90&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How did you try to get the token? Since there are many methods, the process of authentication depends on your code. Please refer to the Python script below, which use a username and a password to get the access token.&lt;/P&gt;
&lt;P&gt;We can get the token for both Native App and Web App unless the AAD requires two-factor&amp;nbsp;authentication.&lt;/P&gt;
&lt;P&gt;Reference:&amp;nbsp;&lt;A href="https://github.com/AzureAD/azure-activedirectory-library-for-python" target="_self"&gt;azure-activedirectory-library-for-python&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-oauth2-implicit-grant-flow" target="_self"&gt;active-directory/develop/v1-oauth2-implicit-grant-flow&lt;/A&gt;.&lt;/P&gt;
&lt;PRE&gt;# adal is azure-activedirectory-library-for-python. install it first.
from adal import AuthenticationContext


# get access token implictly with username and password.
def get_token():
    client_id = "a30***1ae1dcde27e"
    resource_uri = "https://analysis.windows.net/powerbi/api"
    user_name = "d**.com"
    user_password = "password"

    auth_context = AuthenticationContext("https://login.microsoftonline.com/your_tenant_name")
    token_response = auth_context.&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;acquire_token_with_username_password&lt;/STRONG&gt;&lt;/FONT&gt;(resource_uri, user_name, user_password, client_id)
    token = "Bearer " + token_response["accessToken"]
    return token&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Dale&lt;/P&gt;</description>
      <pubDate>Tue, 25 Dec 2018 10:01:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/591143#M17998</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-12-25T10:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: Native App for data push with auto login</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/593558#M18073</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/99291"&gt;@amatteo90&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Could you please mark the proper answers as solutions?&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Dale&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 07:20:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/593558#M18073</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2019-01-02T07:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: Native App for data push with auto login</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/595070#M18113</link>
      <description>I think your answer is unrelated to the problem of authorization, since it only talks about authentication.</description>
      <pubDate>Fri, 04 Jan 2019 08:45:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Native-App-for-data-push-with-auto-login/m-p/595070#M18113</guid>
      <dc:creator>tripleacoder</dc:creator>
      <dc:date>2019-01-04T08:45:01Z</dc:date>
    </item>
  </channel>
</rss>

