Forum Discussion
Problem when publishing API connection (desktop works fine)
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"
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.
12 Replies
- v-janeyg-msftCommunity Support
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.
- boboostRegular Visitor
Hi Janey,
I assume that the credentials are already in the basic authentication.
- v-janeyg-msftCommunity Support
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?