Forum Discussion

mikegoatly's avatar
mikegoatly
Frequent Visitor
6 years ago

Connecting to an API with basic authentication and custom header

We're trying to connect to an API that requires both basic auth and a custom header called "clientid".

 

The data source is configured with basic authentication, and the clientid header is passed through with the web request, like this: 

Source = Web.Contents("...", [Headers=[clientId="..."]])

When configured in this way, Power BI refuses to even execute the API call, giving the error:

clientid header is only supported when connecting anonymously. 
These headers can be used with all authentication types: 
Accept, Accept-Charset, Accept-Encoding, Accept-Language, Cache-Control, Content-Type, If-Modified-Since, Prefer, Referer

So it would seem that Power BI has a safe list for headers that can be used with authentication, and anything that falls outside that is blocked? Assuming there's no other way to inject a custom header into an authenticated request, this means that there's no way for us to make a request to APIs with these requirements.

 

Is there any way to make a request like this successfully?

 

(There is a similar post over here that never got a satisfactory response - to be clear, turning off authentication is not an option!)

2 Replies