Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Web.Contents failing to authenticate with Authorization string variable, only taking string

Hi Team,


I have come across this very strange problem where the ''Authorization' parameter in Web.Contents will fail authentication if using a variable (Shown below with variable token from another query).


I generate in Query 1 the bearer token required for authentication in Query 2, however when passing it into Query 2 the authentication fails.



generate_token= "Bearer XXXX"



the_access_token = generate_token

Source = Json.Document(Web.Contents("", [RelativePath = "XYZ", Headers = [Authorization=the_access_token ]]))




However, running the below with the exact same string except not in parameter form works fine. 

Source = Json.Document(Web.Contents("", [RelativePath = "/XYZ/", Headers = [Authorization="Bearer XXXX"]]))


Any ideas on why this may be?? There are no difference between these two strings.


Community Support
Community Support

Hi @asherbowden ,


Please refer to the following post, it doesn't seem to work using parameter in headers.

Solved: How to specify HTTP request header parameter in Po... - Microsoft Power BI Community


Best Regards,

Stephen Tao


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Power BI Dev Camp Session 27

Ted's Dev Camp

This session walks through creating a new Azure AD B2C tenant and configuring it with user flows and custom policies.

Health and Life Sciences Power BI User Group

Health and Life Sciences Power BI User Group

Power BI specialists at Microsoft have created a community user group where customers in the provider, payor, pharma, health solutions, and life science industries can collaborate.

Top Solution Authors
Top Kudoed Authors