Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
teros
Helper I
Helper I

REST API for PBIRS w/customSecuritySample - how to include cookies?

Still trying to use the REST API for the on-premise Power BI Report Server with the CustomSecuritySample. I know that I need to supply the authentication cookie that is supplied when I log into the site, but so far, I can't seem to figure out how to specify the cookies properly in the header.  I'm using the Swagger library for my REST API calls.

 

I've tried adding a "Cookie" entry via AddDefaultHeader - the method call doesn't generate an error, but Fidder cannot see any cookies.  Is there some other method I should be using to load the cookies with the Swagger objects?

 

Any suggestions?

 

code example:

 

 

            var server = "myinstance.mysite.com";
            string apiString = string.Format("https://{0}/reportsbi/api/v2.0", server);

            var clientCI = new CatalogItemsApi(apiString);
            clientCI.AddDefaultHeader("Content-Type", "application/json;charset=utf-8");
            clientCI.AddDefaultHeader("Cookie", ".ASPXAUTH=" + cookieValue + ";X-XSRF-NONCE=" + nonce + ";X-XSRF-TOKEN=" + token);

            ODataCatalogItems cItems = clientCI.GetCatalogItems();

 

 

 

1 REPLY 1
Anonymous
Not applicable

@teros Were you able to get through the cookies process?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.