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
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Kudoed Authors