The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
I setup a connection with an API in Power BI desktop. This works fine, except when I publish it says that my datasource cannot be refreshed because my credentials are not correct. I think it has something to do with the headers not being passed correctly, apart from the Basic Authentication we also have to pass a Database name: here is my code
let
gdtAuthKey = "Basic EXAMPLEKEY",
gdtAuthResponse= Web.Contents("https://act081.actweb.nl/",
[RelativePath="demords-API/act.web.api/authorize",
Headers=[Authorization=gdtAuthKey, #"Act-Database-Name"="DEMO"]]),
gdtAccessToken = Text.FromBinary(gdtAuthResponse),
#"datelasttime"=DateTime.LocalNow(),
#"token"="Bearer " & gdtAccessToken
in //result
#"token"
Solved! Go to Solution.
Hi thanks, I solved it by clearing the cache in the desktop version, setting the datasource to anonymous en public. I also had to set it to public on the cloud version. then it worked eventually.
Hi, @boboost
There should be no problem with the syntax because It can be refreshed normally in the desktop. Have you added credential information?
Can you show me the screenshot of the refreh history and data source credentials in pbi service >> dateset >> setting?
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Janey,
I assume that the credentials are already in the basic authentication.
Hi, @boboost
The system prompts that your credentials are invalid. Have you tried to re-enter it? Do you need a gateway for your data source?
The data source is just an API with basic authentication, that is already set up in the datasource advanced settings. Next to the basic authenthication as header info i need to give a database name.
I assume when i connect to an API i do not need to use the gateway.
Try to re-edit credentials. Can you show me the details message in error?
Best Regards
Janey Guo
hi, here is the message:
Hi,
I know, here when i enter the credentials:
this is a test site for my api, see that i need to enter THREE things: username password AND databasename:
In the code I already entered the BASIC Authenication string, (so i don't understand why I even should enter credentials.)
@boboost Is the user name and password you entered from a computer or a database?
they are from the database, (the API needs them)
Hi, @boboost
I may not help you due to knowledge limitations. Because it may be that there are restrictions on the use of this data source on the service. But I found some similar solutions, Hope it will help you.
Power BI: Using anonymous authentication on Web data sources with a API key in URL – Kloud Blog
Web API data source refresh issue - Page 3 - Microsoft Power BI Community
Best Regards
Janey Guo
Hi thanks, I solved it by clearing the cache in the desktop version, setting the datasource to anonymous en public. I also had to set it to public on the cloud version. then it worked eventually.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
55 | |
42 | |
24 | |
23 | |
14 |