Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

API Unable to refresh in Power BI Service: The credentials provided for the Web source are invalid.

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. 

4 Replies

  • mattww's avatar
    mattww
    Responsive Resident

    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.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Unfortunately this doesn't resolve my issue.

      • mattww's avatar
        mattww
        Responsive Resident

        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