Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi there,
I'm currently trying to refresh a connection to an API in Power BI Service, but I get the error: "The credentials provided for the Web source are invalid."
In Desktop, it works fine. Do any of you know why this is happening? I've tried anything:
Simple Web.Contents + Header code
Source = Json.Document(Web.Contents("https://api.realworks.nl/wonen/v1/objecten",
[Headers=[Authorization="xxxxxxxxxxxxxxxxxxxxxx"]])),
Seperated url and header
url = "https://api.realworks.nl/wonen/v1/objecten",
headers = [Authorization = "xxxxxxxxxxxxxxxxxxxxxx"],
response = Json.Document(Web.Contents(
url,
[Headers = headers]
)),x
RelativePath version
url = "https://api.realworks.nl",
headers = [Authorization = "xxxxxxxxxxxxxxxxxxxxxx"],
response = Json.Document(Web.Contents(
url,
[RelativePath = "/wonen/v1/objecten",
Headers = headers]
)),
Please help, I'm getting so frustrated here. The Power BI service just keeps giving me this error.
Have you checked your Data source credentials in the Schedule refresh settings on your dataset. Sometimes you might need to tell it to skip test connection if you're authenticating via the headers
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Unfortunately this doesn't resolve my issue.
@Anonymous , one other thing to check is whether you are using Basic Auth?
If you are and have put your credentials in when prompted on Power BI Desktop (i.e. see below), then you don't need the headers in your Web.Contents function as well.
Or alternatively, if you are keeping the authorization header in your Web.Contents, select Anonymous in the above dialog
Just a thought
Hmm, sorry to hear that. I have had similar fiddly issues with API connections and the service not liking it. I would suggest logging a call with Microsoft Support as it looks like you've tried all the right things to make sure the Power BI Service can evaluate the query fine.
I don't know how complicated your report is, so the other thing that might be worth trying is publishing a very simple report made from scratch with just one basic API connection in it. You might have an old data connection in there.
Also, in Power BI Desktop open your data source settings and Clear all permissions in the report. Make sure your authentication method is set to anonymous when reprompted.
Good luck, sorry I can't be of more help