Forum Discussion

Anaplex's avatar
Anaplex
Frequent Visitor
9 years ago

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    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