<?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 Using Cookies Headers in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Using-Cookies-Headers/m-p/1747021#M28618</link>
    <description>&lt;P&gt;Hi Team&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on the suggestion from one of our community members, I was trying cookies as Headers to see if it works.&amp;nbsp;I was trying in PowerBI Desktop but it didn't work as the result for Headers was NULL. Then, I tried this in Visual Studio this morning and struck at a point. Maybe you can help. Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cookies.Feed = () =&amp;gt;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source = Web.Contents(Uri.Combine("&lt;A href="https://abc.123.com" target="_blank"&gt;https://abc.123.com&lt;/A&gt;", "/api/cookie"), [Headers =[#"Authorization"= "Bearer "&amp;amp;&lt;STRONG&gt;TokenMethod&lt;/STRONG&gt;("password", "token", "code")[access_token]]]),&lt;BR /&gt;Source_Headers = Value.Metadata(Source)[Headers],&lt;BR /&gt;Auth_Cookie_Header = Source_Headers[#"Set-Cookie"]&lt;BR /&gt;in&lt;BR /&gt;Auth_Cookie_Header;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this code above, &lt;STRONG&gt;TokenMethod&lt;/STRONG&gt; is a function that gets me the access_token.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My code is big, so sharing what is relevant here. I want to use cookies along with the access_token as HEADERS in this function below:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;System.Feed = (url as text) =&amp;gt;&lt;BR /&gt;let&lt;BR /&gt;source = Web.Contents(url, [Headers = DefaultRequestHeaders]),&lt;BR /&gt;json = Json.Document(source),&lt;/P&gt;&lt;P&gt;in&amp;nbsp;&lt;/P&gt;&lt;P&gt;Json;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I've defined&amp;nbsp;DefaultRequestHeaders as mentioned below:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DefaultRequestHeaders = [&lt;/P&gt;&lt;P&gt;#"Authorization"= "Bearer "&amp;amp;TokenMethod("password", "token", "code")[access_token],&lt;BR /&gt;#"Cookie"=Cookies.Feed()[Auth_Cookie_Header]&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try this, it returns an error stating "&lt;STRONG&gt;We cannot apply field access to the type text&lt;/STRONG&gt;". I think its not the right way for me to define&amp;nbsp;&lt;STRONG&gt;DefaultRequestHeaders &lt;/STRONG&gt;and use it in my&amp;nbsp;&lt;STRONG&gt;System.Feed &lt;/STRONG&gt;function as Headers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help me correct the way it has to be defined. If someone has handled this in their connector, I would appreciate if you could share an example.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Mar 2021 05:25:15 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-03-26T05:25:15Z</dc:date>
    <item>
      <title>Using Cookies Headers</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Using-Cookies-Headers/m-p/1747021#M28618</link>
      <description>&lt;P&gt;Hi Team&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on the suggestion from one of our community members, I was trying cookies as Headers to see if it works.&amp;nbsp;I was trying in PowerBI Desktop but it didn't work as the result for Headers was NULL. Then, I tried this in Visual Studio this morning and struck at a point. Maybe you can help. Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cookies.Feed = () =&amp;gt;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source = Web.Contents(Uri.Combine("&lt;A href="https://abc.123.com" target="_blank"&gt;https://abc.123.com&lt;/A&gt;", "/api/cookie"), [Headers =[#"Authorization"= "Bearer "&amp;amp;&lt;STRONG&gt;TokenMethod&lt;/STRONG&gt;("password", "token", "code")[access_token]]]),&lt;BR /&gt;Source_Headers = Value.Metadata(Source)[Headers],&lt;BR /&gt;Auth_Cookie_Header = Source_Headers[#"Set-Cookie"]&lt;BR /&gt;in&lt;BR /&gt;Auth_Cookie_Header;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this code above, &lt;STRONG&gt;TokenMethod&lt;/STRONG&gt; is a function that gets me the access_token.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My code is big, so sharing what is relevant here. I want to use cookies along with the access_token as HEADERS in this function below:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;System.Feed = (url as text) =&amp;gt;&lt;BR /&gt;let&lt;BR /&gt;source = Web.Contents(url, [Headers = DefaultRequestHeaders]),&lt;BR /&gt;json = Json.Document(source),&lt;/P&gt;&lt;P&gt;in&amp;nbsp;&lt;/P&gt;&lt;P&gt;Json;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I've defined&amp;nbsp;DefaultRequestHeaders as mentioned below:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DefaultRequestHeaders = [&lt;/P&gt;&lt;P&gt;#"Authorization"= "Bearer "&amp;amp;TokenMethod("password", "token", "code")[access_token],&lt;BR /&gt;#"Cookie"=Cookies.Feed()[Auth_Cookie_Header]&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try this, it returns an error stating "&lt;STRONG&gt;We cannot apply field access to the type text&lt;/STRONG&gt;". I think its not the right way for me to define&amp;nbsp;&lt;STRONG&gt;DefaultRequestHeaders &lt;/STRONG&gt;and use it in my&amp;nbsp;&lt;STRONG&gt;System.Feed &lt;/STRONG&gt;function as Headers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help me correct the way it has to be defined. If someone has handled this in their connector, I would appreciate if you could share an example.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 05:25:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Using-Cookies-Headers/m-p/1747021#M28618</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-26T05:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using Cookies Headers</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Using-Cookies-Headers/m-p/1749752#M28643</link>
      <description>&lt;P&gt;DefaultRequestHeaders = [&lt;/P&gt;
&lt;P&gt;"Authorization"= "Bearer "&amp;amp;TokenMethod("password", "token", "code"),&lt;/P&gt;
&lt;P&gt;"Cookie"=Cookies.Feed()&lt;BR /&gt;];&lt;/P&gt;</description>
      <pubDate>Sun, 28 Mar 2021 02:06:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Using-Cookies-Headers/m-p/1749752#M28643</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-03-28T02:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using Cookies Headers</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Using-Cookies-Headers/m-p/1751047#M28666</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/100342"&gt;@lbendlin&lt;/a&gt;&amp;nbsp;I've tried that but it says the credentials provided for the source are invalid. Although, I see the token response successfully. Is there a way to see what is actually returned in the Cookies, that is not being accepted as proper credentials? It is from this function:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cookies.Feed = () =&amp;gt;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source = Web.Contents(Uri.Combine("&lt;A href="https://abc.123.com/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://abc.123.com&lt;/A&gt;", "/api/cookie"), [Headers =[#"Authorization"= "Bearer "&amp;amp;&lt;STRONG&gt;TokenMethod&lt;/STRONG&gt;("password", "token", "code")[access_token]]]),&lt;BR /&gt;Source_Headers = Value.Metadata(Source)[Headers],&lt;BR /&gt;Auth_Cookie_Header = Source_Headers[#"Set-Cookie"]&lt;BR /&gt;in&lt;BR /&gt;Auth_Cookie_Header;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 07:22:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Using-Cookies-Headers/m-p/1751047#M28666</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-29T07:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using Cookies Headers</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Using-Cookies-Headers/m-p/1751800#M28670</link>
      <description>&lt;P&gt;Use the "Diagnose step" feature in Power Query to see the network traffic, or use Fiddler.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 11:53:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Using-Cookies-Headers/m-p/1751800#M28670</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-03-29T11:53:46Z</dc:date>
    </item>
  </channel>
</rss>

