Forum Discussion
Web API Key Authentication
Hello,
I am trying to connect to a Web API in Power BI Desktop. The request requires token authentication with an "api_key" parameter. I continue to get the error that an API key name must be specified in order to provide an API key, but I cannot find where to specify an API key name.
I have already tried the following and none have worked:
- Anonymus authentication with providing the API key in the URL as a parameter
- Basic authentication with the API key as the username
- Web API authentication and provided the api key as the key value
- Adding a Header in the advanced UI called "Authorization" and providing the key. I also tried to specify the API key name here as "api_key".
I have seen other posts suggesting to create a dataflow to solve this but I do not have the ability to create a dataflow.
What is the proper way to provide token authentication for a Web API?
Thanks,
8 Replies
- AnonymousNot applicable
Hi Anonymous ,
As the official document said, "api_key" is just an example, so it should be based on your actual URL in this format: "https://contoso.com/api/customers/get?api_key=****** "
Best Regards,
Eyelyn Qin- AnonymousNot applicable
Hi! so "api_key" is actually the same as I need for my URL format.
Additionally, I attempted to do this just as a Blank Query in the advanced editor to bypass the Authentication in the Web API UI. I am still getting errors. Do you have any other tips on how to get this done?
There really should be a much easier way to provide auth for this...
- lbendlinSuper User
Have a read here Web.Contents - PowerQuery M | Microsoft Docs , specifically the ApiKeyName section.
- AnonymousNot applicable
Hi- I have tried that, I have started a blank query and input Web.Contents("my api URL", [ApiKeyName="api_key"]) and saved it, and tried to Get Data from Web using the same api URL and selecting Web API inputting my key in the box.
I still get the warning that I need to specify an API key name. Could it be that it is not specified in the right editor? Is there any where else to pass this auth?
- lbendlinSuper User
see if this thread helps
A web API key can only be specified when a web API... - Microsoft Power BI Community
Note the Auth trick.
- AnonymousNot applicable
I tried the auth trick by putting the api_key in the URL as a parameter and selecting Anonymous, that did not work. I received the error that I have invalid credentials but when I test my call in Postman with the same api key, it is fine.
This is the query I have currently: which is still giving me the error that I have invalid credentials.
- Victor_LecomteNew Member
Hello Anonymous ,
I am encountering the same issue. Were you able to find a solution?
Thanks,
Victor