cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anaplex
Frequent Visitor

The user was not authorized - Power BI Desktop API Key not working with ApiKeyName

When I hard code my API key into the header of my web call 

 

Headers=[#"X-Api-Key"="XXXX"] it works but if I use ApiKeyName="X-Api-Key" and I get promoted for the API I am getting "The user was not authorized" despite the API key been correct.

 

What am I missing here?

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Anaplex,

 

Since I'm not clear your api structure, I can't reproduce your issue, you should refer to the api document to make sure if the api support the parameter "ApiKeyName".

 

>> if I use ApiKeyName="X-Api-Key" and I get promoted for the API I am getting "The user was not authorized" despite the API key been correct.

 

According to your description, it seems you provide the ApiKeyName and haven't provided the correct parameter value, you can use multiple parameters in headers option to fix the formula, for example:

 

Headers = [APiKeyName= "X-Api-Key",#"X-Api-Key"="xxxx"]

 

If above is not help, please provide more detail information about your issue.

 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!