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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors