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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
CMoerchen
New Member

REST API with User Authentication Connection Issue

Hello! I had been struggling to make a connection with a REST API that also requires user authentication (for reference, Epicor) in Power BI Desktop. I eventually found a messy solution by using a query that hardcodes the API key and valid user credentials in the headers, and passes it to Web.Contents (which is not ideal, so if anyone has any other ideas please let me know!). For authentication, I'm using anonymous.

 

This is the structure:

= let url = "", username = "", password = "", apiKey = "", encodedCredentials = Binary.ToText(Text.ToBinary(username & ":" & password), BinaryEncoding.Base64), headers = [#"Authorization" = "Basic " & encodedCredentials, #"X-API-Key" = apiKey], source = Json.Document(Web.Contents(url, [Headers=headers])) in source

 

Where I'm stuck now is that when I view the published report in Power BI Service, it's not allowing me to refresh since it's saying the credentials are invalid. Is there something else I should try? I'm mostly not sure why it works in desktop and not on the web version.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @CMoerchen,

 

Thank you for reaching out to Microsoft Fabric Community Forum.

 

Power BI Service requires fixed base URLs when using Anonymous authentication with custom headers. Your current scenario likely uses a dynamic url string, which Power BI blocks in the cloud.

 

Go to Dataset Settings > Set the credential method to "Anonymous".

Ensure that BaseUrl is listed as the data source.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!


Regards,
Vinay Pabbu

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @CMoerchen,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Vinay Pabbu

Anonymous
Not applicable

Hi @CMoerchen,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Vinay Pabbu

Anonymous
Not applicable

Hi @CMoerchen,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Vinay Pabbu

Anonymous
Not applicable

Hi @CMoerchen,

 

Thank you for reaching out to Microsoft Fabric Community Forum.

 

Power BI Service requires fixed base URLs when using Anonymous authentication with custom headers. Your current scenario likely uses a dynamic url string, which Power BI blocks in the cloud.

 

Go to Dataset Settings > Set the credential method to "Anonymous".

Ensure that BaseUrl is listed as the data source.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!


Regards,
Vinay Pabbu

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.