<?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: Custom Authentication in Custom Data Connector in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/1631927#M27555</link>
    <description>&lt;P&gt;Hi Lionel,&lt;/P&gt;&lt;P&gt;unfortunately this doesn't do anything for me.&lt;/P&gt;&lt;P&gt;I'm trying to build the custom data connector in Visual Studio, not access the data via an existing data connector.&lt;/P&gt;&lt;P&gt;As I mentioned in my original post I can get access to the data already in Power BI/Excel, but to do so I have to use Anonymous authentication and hard code in the username and password. This is neither portable, nor safe when extending to other users.&lt;/P&gt;&lt;P&gt;What I need to be able to do is capture the username and password entered for the Basic authentication credentials and then pass them through a custom authentication procedure in the connector I am building.&lt;/P&gt;&lt;P&gt;While I have seen a number of ways of doing this via OAuth authentication, that is not an option in my case.&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jan 2021 13:19:32 GMT</pubDate>
    <dc:creator>nzimmerman</dc:creator>
    <dc:date>2021-01-29T13:19:32Z</dc:date>
    <item>
      <title>Custom Authentication in Custom Data Connector</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/1624361#M27510</link>
      <description>&lt;P&gt;Trying to build a custom data connector for a website that uses an authentication flow that doesn't neatly fit in with the default options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The authentication flow is like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. send a GET request to &lt;A href="https://www.example.com/api/authenticate?username=&amp;quot;joesmith&amp;quot;&amp;amp;password=&amp;quot;abcd1234&amp;nbsp;" target="_blank"&gt;https://www.example.com/api/authenticate?username="joesmith"&amp;amp;password="abcd1234&amp;nbsp;&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;This returns a json encoded authentication token, which I can base 64 encode and pass in the headers of a Web.Contents call&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. call any other api endpoint with Basic authentication using the supplied username and authentication token&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Source = Json.Document(Web.Contents(&lt;A href="https://www.example.com/api/products?skip=0" target="_blank" rel="noopener"&gt;https://www.example.com/api/products?skip=0&lt;/A&gt;, [Headers=[Accept="application/json", Authorization="Basic " &amp;amp; AuthorizationToken]]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works fine in a normal query.&lt;/P&gt;&lt;P&gt;We just set authentication to Anonylous and hard code in the username and password.&lt;/P&gt;&lt;P&gt;But that won't work for a custom data connector.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the custom data connector if I set the authetnication to UsernamePassword it fails because the website doesn't use basic authetnication to generate the authentication token.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I set authentication to Anonymous I don't have the username and password I need to generate the authentication token.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've spent a fair amount of time searching and have yet to come up with a way of generating a custom credential prompt that will let me get at the username/password fields of Extension.CurrentCredential().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've also not seen a way to trap the authentication error, which would then let me handle the authenication on my own.&lt;/P&gt;&lt;P&gt;For this last one I've tried adding ManualStatusHandling = {401} to the Web.Contents call.&lt;/P&gt;&lt;P&gt;However, it doesn't seem to get trapped. (checking the result for an error field in the json doesn't appear to happen).&lt;/P&gt;&lt;P&gt;Maybe I'm doing that incorrectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried setting authentication to UsernamePassword and passing ManualCredentials = true to Web.Contents, hoping that I could then grab the username and password and do the authentical manually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it appears that the extension is attempting to validate the credentials on the website via Basic Auth before executing the Web.Contents call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I'm mistaken about this suggestions on doing the call properly would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ned&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 17:40:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/1624361#M27510</guid>
      <dc:creator>nzimmerman</dc:creator>
      <dc:date>2021-01-26T17:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Authentication in Custom Data Connector</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/1631077#M27549</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/282231"&gt;@nzimmerman&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can refer to this.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/power-query/connectorauthentication" target="_self"&gt;Authentication with a data source&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Lionel Chen&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2021 07:36:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/1631077#M27549</guid>
      <dc:creator>v-lionel-msft</dc:creator>
      <dc:date>2021-01-29T07:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Authentication in Custom Data Connector</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/1631927#M27555</link>
      <description>&lt;P&gt;Hi Lionel,&lt;/P&gt;&lt;P&gt;unfortunately this doesn't do anything for me.&lt;/P&gt;&lt;P&gt;I'm trying to build the custom data connector in Visual Studio, not access the data via an existing data connector.&lt;/P&gt;&lt;P&gt;As I mentioned in my original post I can get access to the data already in Power BI/Excel, but to do so I have to use Anonymous authentication and hard code in the username and password. This is neither portable, nor safe when extending to other users.&lt;/P&gt;&lt;P&gt;What I need to be able to do is capture the username and password entered for the Basic authentication credentials and then pass them through a custom authentication procedure in the connector I am building.&lt;/P&gt;&lt;P&gt;While I have seen a number of ways of doing this via OAuth authentication, that is not an option in my case.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2021 13:19:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/1631927#M27555</guid>
      <dc:creator>nzimmerman</dc:creator>
      <dc:date>2021-01-29T13:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Authentication in Custom Data Connector</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/2269960#M33784</link>
      <description>&lt;P&gt;Hi, same problem for me, did you find any solution or way to make it works ?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jan 2022 16:57:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/2269960#M33784</guid>
      <dc:creator>pierregeraud</dc:creator>
      <dc:date>2022-01-06T16:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Authentication in Custom Data Connector</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/2270020#M33786</link>
      <description>&lt;P&gt;No, unfortunately.&lt;/P&gt;&lt;P&gt;I have a gut sense that something may be possible using WebAction.Request.&lt;/P&gt;&lt;P&gt;But from what I can tell this will only work when implemented from within a connector in VS.&lt;/P&gt;&lt;P&gt;I don't believe you can test it by doing a direct query from Power BI.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just have not had time to go back and hack at it again.&lt;/P&gt;&lt;P&gt;Best of luck to you.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jan 2022 17:27:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/2270020#M33786</guid>
      <dc:creator>nzimmerman</dc:creator>
      <dc:date>2022-01-06T17:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Authentication in Custom Data Connector</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/3188815#M42205</link>
      <description>&lt;P&gt;We have a similar problem with one of our data sources.&amp;nbsp; In our case it only supports "password" OAuth grant type, which isn't supported by the OAuth Authentication type.&amp;nbsp; Our solution was to use UsernamePassword like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//&amp;nbsp; BEGIN SAMPLE&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[DataSource.Kind=&lt;/SPAN&gt;&lt;SPAN&gt;"SamplePowerConnector"&lt;/SPAN&gt;&lt;SPAN&gt;, Publish=&lt;/SPAN&gt;&lt;SPAN&gt;"SamplePowerConnector.Publish"&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;shared&lt;/SPAN&gt;&lt;SPAN&gt; SamplePowerConnector.Contents = Value.ReplaceType(SampleConnector.Contents, &lt;/SPAN&gt;&lt;SPAN&gt;type&lt;/SPAN&gt; &lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; (ApiQueryUrl &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;SPAN&gt; Uri.Type) &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;any&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;SampleConnector.Contents = (ApiQueryUrl &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;text&lt;/SPAN&gt;&lt;SPAN&gt;) =&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;let&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; creds = Extension.CurrentCredential(),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; apiPart = &lt;/SPAN&gt;&lt;SPAN&gt;"/api/"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; BaseUrL = Text.BeforeDelimiter(ApiQueryUrl, apiPart)&amp;amp;apiPart,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; relativeUrl = Text.AfterDelimiter(ApiQueryUrl, apiPart),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; uname = creds[Username],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pw = creds[Password],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; token = SampleApiToken(BaseUrL, uname, pw),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; responseViaApi = SampleApiQuery(BaseUrL, relativeUrl, token),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value = Table.ExpandListColumn(responseViaApi, &lt;/SPAN&gt;&lt;SPAN&gt;"value"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;SampleApiToken = (baseurl &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;text&lt;/SPAN&gt;&lt;SPAN&gt;, username &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;text&lt;/SPAN&gt;&lt;SPAN&gt;, password &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;text&lt;/SPAN&gt;&lt;SPAN&gt;) =&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;let&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RequestBody = &lt;/SPAN&gt;&lt;SPAN&gt;"grant_type=password&amp;amp;username="&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;username&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;"&amp;amp;password="&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;password,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ContentType = &lt;/SPAN&gt;&lt;SPAN&gt;"application/x-www-form-urlencoded"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response = Json.Document(Web.Contents(baseurl, [RelativePath = &lt;/SPAN&gt;&lt;SPAN&gt;"Token"&lt;/SPAN&gt;&lt;SPAN&gt;, Headers=[#"Content-Type"=ContentType], Content=Text.ToBinary(RequestBody)])),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AccessToken = Response[access_token]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AccessToken;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;SampleApiQuery = (baseurl &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;text&lt;/SPAN&gt;&lt;SPAN&gt;, relativeUrl &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;text&lt;/SPAN&gt;&lt;SPAN&gt;, token &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;text&lt;/SPAN&gt;&lt;SPAN&gt;) =&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;let&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GetComponentsThruApi1 = Json.Document(Web.Contents(baseurl, &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Headers = [#"Authorization" = &lt;/SPAN&gt;&lt;SPAN&gt;"Bearer "&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp; &amp;nbsp;token],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RelativePath = relativeUrl])),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #"Converted to Table" = Record.ToTable(GetComponentsThruApi1)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;in&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #"Converted to Table"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SamplePowerConnector = [&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; TestConnection = (dataSourcePath) =&amp;gt; {&lt;/SPAN&gt;&lt;SPAN&gt;"SamplePowerConnector.Contents"&lt;/SPAN&gt;&lt;SPAN&gt;, dataSourcePath},&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; Authentication = [&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UsernamePassword = []&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; Label = Extension.LoadString(&lt;/SPAN&gt;&lt;SPAN&gt;"AuthenticationLabel"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;// END SAMPLE&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Now a call to&amp;nbsp;SamplePowerConnector.Contents("&lt;A href="https://www.example.com/api/querystring" target="_blank"&gt;https://www.example.com/api/querystring&lt;/A&gt;") will result first in a call to &lt;A href="https://www.example.com/api/Token" target="_blank"&gt;https://www.example.com/api/Token&lt;/A&gt;&amp;nbsp;to get the access_token, which is then passed to the actual query and added to the Headers as a Bearer token.&amp;nbsp; You can do something similar in your version of SampleApiToken, but with a RelativePath of "authenticate?username="&amp;amp;username&amp;amp;"&amp;amp;password="&amp;amp;password.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The secret sauce here is that the connector handles all of the communication with the external data source, not just the authentication.&amp;nbsp; This means you won't use Web.Contents to get your data in your queries, you'll use SamplePowerConnector.Contents.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 14 Apr 2023 14:56:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/3188815#M42205</guid>
      <dc:creator>tmvander</dc:creator>
      <dc:date>2023-04-14T14:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Authentication in Custom Data Connector</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/3188830#M42206</link>
      <description>&lt;P&gt;I should point out the obvious here - this solution is still a bit of a hack in that every query still needs to re-authenticate with the external datasource and get a new token since there isn't a way to save the token or handle expiration or refresh of the token.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 15:05:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Authentication-in-Custom-Data-Connector/m-p/3188830#M42206</guid>
      <dc:creator>tmvander</dc:creator>
      <dc:date>2023-04-14T15:05:28Z</dc:date>
    </item>
  </channel>
</rss>

