<?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 Passing Cookies Between HTTPS requests in Power Query in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Passing-Cookies-Between-HTTPS-requests-in-Power-Query/m-p/3190048#M42215</link>
    <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use my credentials to log in a url and then use the same cookies to fetch the data from another related url. I keep getting the below error message that I don't know how to avoid in the 'Reponse' step. I believe is related to the type of Session being passed to Web.Contents().&amp;nbsp;&lt;BR /&gt;&lt;EM&gt;Expression.Error: We cannot convert a value of type Binary to type Text.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Details:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Value=[Binary]&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Type=[Type]&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;This is my piece of code. I'd very much appreciate any help on getting it right:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;LoginUrl = "&lt;A href="https://example.com/auth/login" target="_blank"&gt;https://example.com/auth/login&lt;/A&gt;",&lt;BR /&gt;SecureUrl = "&lt;A href="https://example.com/status/" target="_blank"&gt;https://example.com/status/&lt;/A&gt;",&lt;BR /&gt;Payload = [ username = "myusername", password = "strongpass" ],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Create a new session and log in&lt;BR /&gt;Session = Web.Contents(LoginUrl, [&lt;BR /&gt;Headers = [#"Content-Type" = "application/x-www-form-urlencoded"],&lt;BR /&gt;Content = Text.ToBinary(Uri.BuildQueryString(Payload)),&lt;BR /&gt;ManualStatusHandling={400,401,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,422,423,424,425,426,427,428,429,431,451,500,501,502,503,504,505,506,507,508,509,510,511}&lt;BR /&gt;]),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Get the secure page using the authenticated session&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response = Web.Contents(SecureUrl, [Headers=[Cookie=Text.Combine(Binary.ToText(Web.Contents(Session, [RelativePath=""])), "; ")]]),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Content = Text.FromBinary(Response)&lt;BR /&gt;in&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Content&lt;BR /&gt;&lt;BR /&gt;Thank you very much in advance!&lt;/P&gt;&lt;P&gt;Javier&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 16 Apr 2023 13:52:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-04-16T13:52:46Z</dc:date>
    <item>
      <title>Passing Cookies Between HTTPS requests in Power Query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Passing-Cookies-Between-HTTPS-requests-in-Power-Query/m-p/3190048#M42215</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use my credentials to log in a url and then use the same cookies to fetch the data from another related url. I keep getting the below error message that I don't know how to avoid in the 'Reponse' step. I believe is related to the type of Session being passed to Web.Contents().&amp;nbsp;&lt;BR /&gt;&lt;EM&gt;Expression.Error: We cannot convert a value of type Binary to type Text.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Details:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Value=[Binary]&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Type=[Type]&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;This is my piece of code. I'd very much appreciate any help on getting it right:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;LoginUrl = "&lt;A href="https://example.com/auth/login" target="_blank"&gt;https://example.com/auth/login&lt;/A&gt;",&lt;BR /&gt;SecureUrl = "&lt;A href="https://example.com/status/" target="_blank"&gt;https://example.com/status/&lt;/A&gt;",&lt;BR /&gt;Payload = [ username = "myusername", password = "strongpass" ],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Create a new session and log in&lt;BR /&gt;Session = Web.Contents(LoginUrl, [&lt;BR /&gt;Headers = [#"Content-Type" = "application/x-www-form-urlencoded"],&lt;BR /&gt;Content = Text.ToBinary(Uri.BuildQueryString(Payload)),&lt;BR /&gt;ManualStatusHandling={400,401,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,422,423,424,425,426,427,428,429,431,451,500,501,502,503,504,505,506,507,508,509,510,511}&lt;BR /&gt;]),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Get the secure page using the authenticated session&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response = Web.Contents(SecureUrl, [Headers=[Cookie=Text.Combine(Binary.ToText(Web.Contents(Session, [RelativePath=""])), "; ")]]),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Content = Text.FromBinary(Response)&lt;BR /&gt;in&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Content&lt;BR /&gt;&lt;BR /&gt;Thank you very much in advance!&lt;/P&gt;&lt;P&gt;Javier&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Apr 2023 13:52:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Passing-Cookies-Between-HTTPS-requests-in-Power-Query/m-p/3190048#M42215</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-16T13:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Cookies Between HTTPS requests in Power Query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Passing-Cookies-Between-HTTPS-requests-in-Power-Query/m-p/3192393#M42244</link>
      <description>&lt;P&gt;Rather ambitious.&amp;nbsp; Note that you can simplify lists via ..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{400..431,451,500..511}&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 23:36:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Passing-Cookies-Between-HTTPS-requests-in-Power-Query/m-p/3192393#M42244</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-04-17T23:36:00Z</dc:date>
    </item>
  </channel>
</rss>

