Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
asherbowden
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.

 

Query1

generate_token= "Bearer XXXX"

 

Query2

the_access_token = generate_token

Source = Json.Document(Web.Contents("https://ABC.com", [RelativePath = "XYZ", Headers = [Authorization=the_access_token ]]))

 

asherbowden_0-1647994378798.png

 

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

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

 

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

 

1 REPLY 1
v-stephen-msft
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

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors