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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
boboost
Regular Visitor

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"

1 ACCEPTED 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.

View solution in original post

12 REPLIES 12
v-janeyg-msft
Community Support
Community 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?

vjaneygmsft_0-1624850917175.png

 

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. 

boboost_0-1624861534079.png

 

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?

vjaneygmsft_0-1624960193174.png

 

 

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.

@boboost  

 

Try to re-edit credentials. Can you show me the details message in error?

vjaneygmsft_1-1625449091870.png

Best Regards

Janey Guo

hi, here is the message:

boboost_0-1626421706159.pngboboost_1-1626421832437.png

 

Hi, @boboost 

 

The credential information seems to be incomplete.

vjaneygmsft_0-1626422104282.png

 

Best Regards

Janey Guo

 

Hi,

 

I know, here when i enter the credentials:

boboost_0-1626422864668.png

 

this is a test site for my api, see that i need to enter THREE things: username password AND databasename:

boboost_1-1626423087389.png

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.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors