Showing results for 
Search instead for 
Did you mean: 
Helper III
Helper III

How to use "set-cookies"



Could someone help me understand how to use "set-cookies" in power query. I've been trying this from a long time but do not have any success. I do not see any documentation that could guide me. I've looked at pretty much all the mentions of cookies in the community and none of it helped. 


Here is my code:



request = Web.Contents("https://domain/api/cookie", [Headers=[#"Authorization"="Bearer "&Access_Token("password","token","code")[access_token]]),// Only this gets me the response as


//response = Json.FromValue(request),
//converttojson = Json.Document(response)


body = Json.Document(request),
result = if (Record.HasFields(body, {"error", "error_description"})) then
error Error.Record(body[error], body[error_description], body)


I'm not sure how to use "set-cookies" in the above code as the way it is being used in the below code:


---> var cookie = "";

---> var headersForCookie = {
"Host": "",
"Authorization": "Bearer "+ token

"url": "/api/cookie",
"method": "GET",
"headers": headersForCookie

in = (err, res, body){
print of// this is a very important step of verification: JSON.docume(res.headers["set-cookie"])}
cookie = res.headers["set-cookie"];


I would really appreciate some help on this. 

Helper III
Helper III

Hello Team


I'm still chasing for the information on cookies. I would appreciate any response.

Helper III
Helper III

Its been quite some time and I'm still trying to get information on this. I know we would go out of vacation soon or some would already be on vacation. I would appreciate any inputs before we all head out to our vacation. 


Wishing you all happy holidays. 

Helper III
Helper III

@dm-p Thank you for the response. Unfortunately, I don't have a pro account to submit a ticket and from our organisation it might not be possible to get a pro account. Hence, I've been running back and forth in the community here and other places on the internet. 


I've looked at the references you have shared and unfortunately, they haven't helped. However, I appreciate your response. 

Helper III
Helper III

Does anyone have any inputs on this. I would appreciate any response. 

Hi @AfsarP1,

From the looks of things, you've mined all existing community content and come up with no further solutions. I suspect that if someone would have figured this out within the community, it would have been shared and searchable in some capacity, as it would be pretty valuable for a lot of people. I would say that if Chris Webb doesn't have a post about it then it's probably not a thing (here's his power query post archive if you want to take a look).

There is some support for authorisation/session handling in custom connectors, but I believe that this is currently all that's possible at present. I don't do any work in this area so can't advise further but there might be something in that documentation that might be able to help you, if you haven't tried it already.

If you're at your limit with the community resources, have you tried opening a support ticket with Microsoft to get an official answer? If you have a pro subscription, support is free.

I personally haven't got this to work in Power Query. In my case, I ended up writing an Azure Function to abstract the logic to a C# endpoint, which would handle this part and return the results to Power Query, effectively wrapping the web API and making it a simple HTTP request for Power Query. The function cost nothing to host and run as the workload could be handled under the consumption plan, and maybe a few hours of my time to write the code. If you're familiar with C#, JS/TS, Python, PHP, Java or PowerShell then these can be a cheap, quick and secure way to manage these kinds of issues, if you haven't considered them.

Good luck,


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

My course: Introduction to Developing Power BI Visuals

Helper III
Helper III

@Team I've explored everything there is on the internet about cookies using power queries. There is very limited or no information. There have been a very few posts in the past about cookies asking different questions. Looks like a handful of connector might have tried using cookies so far but there is no concrete information online. Could someone from the Microsoft Team, let me know if there is a way to use cookies in Power Query. 

If someone from the community has done it, I would appreciate your inputs.  

Helper III
Helper III

Any help on this would be appreciated. I don't seem to have any alternative to understand this than reaching out to the community. 

Helpful resources


Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.