Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
466 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Using cookie authentication in Power BI APIs |
---|
Most APIs use a Key for authentication but some use your browser's cookies instead. This blog covers the basics on how to reference cookies in your Power BI API connection. |
This blog covers an advanced form of API authentication when connecting to web data sources in Power BI. For information of API basics read this blog and for API keys read this one.
When connecting to some APIs you may find that they don't have the ability to accept a key but generate an error when using the Anonymous authentication option.
This API doesn't use a key so neither previous option works.
Instead, it uses a browser cookie to record that the user logged in with the correct credentials.
This is useful when the client may request data from multiple APIs located on the same server.
Without this cookie, connecting to the API in the browser won't work.
The API returns an access denied error when the cookie is missing.
To generate the cookie I need to login to the target website before connecting to the API.
Please do not feed cookies to wild owls.
Now run the API within the browser to check everything is working.
This API returns JSON data and Google provides a Pretty print option that helps readability!
Now we have connected to the website and the API it's time to find the cookie.
Right click on the browser window and choose Inspect to open additional settings.
How many of us ever open these settings?
This page lets you see the parts of the webpage including, on the Elements tab, the HTML code.
A very simple page with no style sheets and the JSON output in the body.
Switch to the Network tab which contains activity, including any communication with the website's server.
Websites like PoorSQL work mainly client side meaning everything is done in the browser.
On the left in the Name section click on the first item in the list which is the main body of the page.
The favicon is an image that appears on the tab of your web browser.
From the Headers section scroll down to the Cookie and copy the contents.
Web pages can have multiple sections that require a cookie each but APIs tend to need only one.
With our delicious cookie in hand switch back to Power BI and create a new Web connection.
Probably my most used data source.
Enter your API path and switch to the Advanced section.
This section is often used for parameterising parts of the URL.
Scroll to the bottom and enter Cookie as the header name and paste the cookie we copied earlier.
Another possible header would be method: which you can use to change the API behaviour from the default of GET.
Click the OK button to send the request and hopefully get a response!
This API returns JSON data which Power BI converted into a table of useable data.
A Human Bard leading the charge? Feels unlikely.
Some other pages relevant to the above blog include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2025. All Rights Reserved.