Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Data source accessing a web URL which requires Authentication headers

I have a PowerBI Desktop query/report which is working, but when I publish this into PowerBI Service, I have problems. The service cannot properly refresh the data source due to invalid credentials. ...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Thank you. I have now managed to spend some more time on this.

    I can confirm that the suggested work-around to use the RelativePath parameter solves the problem.

    I do not need to use static values for my Authorization parameters, which is good, because I don't want to have to duplicate these across many queries. This is the query which now works for me.

        Source = Json.Document(Web.Contents("https://api.harvestapp.com/",
            [
             RelativePath="v2/time_entries",
             Query=[from=DateThreshold],
             Headers=[Authorization="Bearer " & HarvestAccessToken, #"Harvest-Account-ID"=HarvestAccountId, #"User-Agent"="PowerBI_DBRetrieval (" & HarvestUserEmail & ")"]]
            )),

    The important point, for this API, is that the root URL is not authenticated, so this passes the credentials check. When the real query is executed, the RelativePath, Query, and Headers are all correctly processed.