<?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: Expression.Error:  &amp;quot;The 'Authorization' header is only supported during anonymous connection in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Expression-Error-quot-The-Authorization-header-is-only-supported/m-p/4734722#M10216</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1290855" data-lia-user-login="hajar_bkg" class="lia-mention lia-mention-user"&gt;hajar_bkg&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thank you for the detailed explanation and context. You're on the right track, but you've encountered a known limitation in Fabric Dataflow Gen2.&lt;/P&gt;
&lt;P&gt;Dynamic Authorization headers, even with anonymous connection mode, are currently not supported in Dataflows Gen2 due to platform-level security restrictions. This is why your approach using #"Authorization" = GetToken() is causing the Expression.Error.&lt;/P&gt;
&lt;P&gt;The recommended solution is to shift token-based logic to a proxy service (such as an Azure Function or Power Automate flow) that manages authentication and returns clean JSON data. Your Dataflow can then connect to that service anonymously and securely.&lt;/P&gt;
&lt;P&gt;This limitation is acknowledged by Microsoft, and improvements may be forthcoming. For now, using a proxy service is the most reliable and scalable workaround.&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Dataflow/API-in-dataflowgen2/m-p/3566455" target="_blank" rel="noopener"&gt;Solved: Re: API in dataflowgen2 - Microsoft Fabric Community&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;I hope this helped! Feel free to ask any further questions. If this resolved your issue, please mark it as "Accept as Solution" and give us Kudos to assist others.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Thank you,&lt;BR /&gt;Sahasra&lt;BR /&gt;Communtiy Support Team.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jun 2025 11:28:31 GMT</pubDate>
    <dc:creator>v-sgandrathi</dc:creator>
    <dc:date>2025-06-17T11:28:31Z</dc:date>
    <item>
      <title>Expression.Error:  "The 'Authorization' header is only supported during anonymous connection</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Expression-Error-quot-The-Authorization-header-is-only-supported/m-p/4734444#M10206</link>
      <description>&lt;P&gt;Hello Power BI / Fabric / Power Query Community,&lt;/P&gt;&lt;P&gt;I'm working on a Dataflow Gen2 in Microsoft Fabric to connect to a REST API that requires dynamic Bearer token authentication. I'm hitting a wall with how Power Query handles the Authorization header, especially when the web connection is set to "Anonymous." I've been going in circles with various error codes, and I'm hoping someone has encountered this and found a robust solution or best practice for Dataflow Gen2.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Goal:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Perform a Basic authentication call to a login endpoint to retrieve a Bearer token. (Works Fine)&lt;/LI&gt;&lt;LI&gt;Use this dynamically acquired Bearer token in the Authorization header for subsequent Web.Contents calls to retrieve actual data from other API endpoints. (Issue)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;My Setup:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Environment:&lt;/STRONG&gt; Microsoft Fabric Dataflow Gen2.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Login M Function (GetToken):&lt;/STRONG&gt; This function successfully retrieves the Bearer token using Basic authentication. (It uses Authorization = "Basic ...")&lt;/P&gt;&lt;P&gt;Extrait de code&lt;/P&gt;&lt;P&gt;let&lt;/P&gt;&lt;P&gt;// Assuming USER, PASSWORD, URL are defined&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;combined&lt;/SPAN&gt;&lt;!--        notionvc: b960e4b8-f5d7-43db-b8c9-1019f8dc4cc3        --&gt;= Text.ToBinary(USER &amp;amp; ":" &amp;amp; PASSWORD),&lt;/P&gt;&lt;P&gt;encoded = Binary.ToText(combined, BinaryEncoding.Base64),&lt;/P&gt;&lt;P&gt;authHeader = "Basic " &amp;amp; encoded,&lt;/P&gt;&lt;P&gt;Source = () =&amp;gt; // This function correctly returns "Bearer&lt;/P&gt;&lt;P&gt;&amp;lt;token&amp;gt;"&lt;/P&gt;&lt;P&gt;let&lt;/P&gt;&lt;P&gt;requestOptions = [&lt;/P&gt;&lt;P&gt;Timeout = #duration(0, 0, 1, 0),&lt;/P&gt;&lt;P&gt;Headers = [&lt;/P&gt;&lt;P&gt;Authorization= authHeader,&lt;/P&gt;&lt;P&gt;#"Content-Type" = "application/json"&lt;/P&gt;&lt;P&gt;]&lt;/P&gt;&lt;P&gt;],&lt;/P&gt;&lt;P&gt;response = Web.Contents(URL &amp;amp; "/app/rest/login",requestOptions),&lt;/P&gt;&lt;P&gt;data = Json.Document(response, 65001),&lt;/P&gt;&lt;P&gt;records = Table.FromRecords({data}),&lt;/P&gt;&lt;P&gt;expandedTable = Table.ExpandRecordColumn(records, "data", {"token"}, {"data.token"}), firstValue = Table.FirstValue(expandedTable)&lt;/P&gt;&lt;P&gt;in&lt;/P&gt;&lt;P&gt;"Bearer " &amp;amp; firstValue&lt;/P&gt;&lt;P&gt;in&lt;/P&gt;&lt;P&gt;Source&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Data Retrieval M Function (Source):&lt;/STRONG&gt; This function is supposed to use the token from GetToken().&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Web Data Source Configuration (in Dataflow Gen2 UI):&lt;/STRONG&gt; The connection is set to &lt;STRONG&gt;"Anonyme" (Anonymous)&lt;/STRONG&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Error &amp;amp; My Attempt:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;// Code in Source function, after previous fixes&lt;/P&gt;&lt;P&gt;requestOptions = [&lt;/P&gt;&lt;P&gt;Headers = [#"Content-type"="application/json", #"Authorization" = GetToken()],&lt;/P&gt;&lt;P&gt;],&lt;/P&gt;&lt;P&gt;response = Web.Contents(fullUrl, requestOptions),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Persistent Error: "Authorization" header restricted (ErrorCode 10348 - Contradictory!)&lt;/P&gt;&lt;P&gt;Even with #"Authorization" = GetToken(), the same ErrorCode 10348 persisted, with a new message:&lt;/P&gt;&lt;P&gt;Expression.Error: "The 'Authorization' header is only supported during anonymous connection. These headers can be used with all authentication types: Accept, Accept-Charset, ...")&lt;/P&gt;&lt;P&gt;This is the core paradox: it states Authorization is only supported for anonymous, but then throws an error when my connection is anonymous.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Any insights or guidance would be greatly appreciated!&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;!--         notionvc: 2557ae8a-63ab-4f23-bc02-26ce5749b77d         --&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2025 07:58:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Expression-Error-quot-The-Authorization-header-is-only-supported/m-p/4734444#M10206</guid>
      <dc:creator>hajar_bkg</dc:creator>
      <dc:date>2025-06-17T07:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Expression.Error:  "The 'Authorization' header is only supported during anonymous connection</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Expression-Error-quot-The-Authorization-header-is-only-supported/m-p/4734722#M10216</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1290855" data-lia-user-login="hajar_bkg" class="lia-mention lia-mention-user"&gt;hajar_bkg&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thank you for the detailed explanation and context. You're on the right track, but you've encountered a known limitation in Fabric Dataflow Gen2.&lt;/P&gt;
&lt;P&gt;Dynamic Authorization headers, even with anonymous connection mode, are currently not supported in Dataflows Gen2 due to platform-level security restrictions. This is why your approach using #"Authorization" = GetToken() is causing the Expression.Error.&lt;/P&gt;
&lt;P&gt;The recommended solution is to shift token-based logic to a proxy service (such as an Azure Function or Power Automate flow) that manages authentication and returns clean JSON data. Your Dataflow can then connect to that service anonymously and securely.&lt;/P&gt;
&lt;P&gt;This limitation is acknowledged by Microsoft, and improvements may be forthcoming. For now, using a proxy service is the most reliable and scalable workaround.&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Dataflow/API-in-dataflowgen2/m-p/3566455" target="_blank" rel="noopener"&gt;Solved: Re: API in dataflowgen2 - Microsoft Fabric Community&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;I hope this helped! Feel free to ask any further questions. If this resolved your issue, please mark it as "Accept as Solution" and give us Kudos to assist others.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Thank you,&lt;BR /&gt;Sahasra&lt;BR /&gt;Communtiy Support Team.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2025 11:28:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Expression-Error-quot-The-Authorization-header-is-only-supported/m-p/4734722#M10216</guid>
      <dc:creator>v-sgandrathi</dc:creator>
      <dc:date>2025-06-17T11:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Expression.Error:  "The 'Authorization' header is only supported during anonymous connection</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Expression-Error-quot-The-Authorization-header-is-only-supported/m-p/4738566#M10315</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1290855" data-lia-user-login="hajar_bkg" class="lia-mention lia-mention-user"&gt;hajar_bkg&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope you're doing well! Just following up to see if the response we shared was helpful. If you have any further questions or need clarification, we’re here to assist.&lt;/P&gt;
&lt;P&gt;If your issue is resolved, please consider marking the answer as &lt;I&gt;Accepted&lt;/I&gt; and giving it a &lt;I&gt;Kudos&lt;/I&gt; to help others in the community.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for being a part of the Microsoft Fabric Community!&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jun 2025 10:26:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Expression-Error-quot-The-Authorization-header-is-only-supported/m-p/4738566#M10315</guid>
      <dc:creator>v-sgandrathi</dc:creator>
      <dc:date>2025-06-20T10:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Expression.Error:  "The 'Authorization' header is only supported during anonymous connection</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Expression-Error-quot-The-Authorization-header-is-only-supported/m-p/4742985#M10409</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1290855" data-lia-user-login="hajar_bkg" class="lia-mention lia-mention-user"&gt;hajar_bkg&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We wanted to check if you had a chance to review our last reply. Let us know if it helped or if you need more guidance, we're always happy to help further.&lt;/P&gt;
&lt;P&gt;If the solution worked for you, please click Accept as Solution and feel free to leave a Kudos for visibility.&lt;/P&gt;
&lt;P&gt;Looking forward to hearing from you!&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2025 04:17:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Expression-Error-quot-The-Authorization-header-is-only-supported/m-p/4742985#M10409</guid>
      <dc:creator>v-sgandrathi</dc:creator>
      <dc:date>2025-06-25T04:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Expression.Error:  "The 'Authorization' header is only supported during anonymous connection</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Expression-Error-quot-The-Authorization-header-is-only-supported/m-p/4747143#M10474</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1290855" data-lia-user-login="hajar_bkg" class="lia-mention lia-mention-user"&gt;hajar_bkg&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We wanted to follow up to see if our suggestion was helpful. Please let us know how things are progressing and if you are still encountering any issues.&lt;/P&gt;
&lt;P&gt;If the response resolved your problem, you may mark it as the solution and give it a thumbs up to assist others in the community as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Than you.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jun 2025 07:15:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Expression-Error-quot-The-Authorization-header-is-only-supported/m-p/4747143#M10474</guid>
      <dc:creator>v-sgandrathi</dc:creator>
      <dc:date>2025-06-28T07:15:03Z</dc:date>
    </item>
  </channel>
</rss>

