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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bbdiitmanager
Regular Visitor

API Authentication Issue

Hello!

 

I am struggling to get Basic authentication working with a REST API.

 

I keep getting the very generic error "We couldn't authenticate with the credentials provided." I have verified multiple times that the credentials are correct, and they also work when I use the URL in a browser.

 

There's nothing unusual about this API, it's a standard REST API with JSON output.

 

I opened up Fiddler and watched the process when I try to submit the credentials. The authorization header does appear and is correct. The initial response is an HTTP 307 so Power BI is following this redirect, but in the subsequent call the Authorization header is dropped resulting in a 401 which is why I believe I'm getting the error message.

 

Any thoughts on how to get past this or troubleshoot to see if something else might be causing the authentication failure? Or is there a way to get Power BI to maintain the Authorization header through the redirect?

 

Thanks!

4 REPLIES 4
bbdiitmanager
Regular Visitor

Follow up:

 

I can reproduce the issue in Postman by turning off "Automatically follow redirects".

 

Seems to me that Power BI is not following 3xx status codes.

 

I found this thread: https://community.powerbi.com/t5/Power-Query/oAuth-and-Power-Query/td-p/361353 but there's no solution.

 

Any ideas?

 

Thanks!

bbdiitmanager
Regular Visitor

Thanks for the replies! Unfortunately, none of the links provided covered the symptoms I am experiencing. They are more generic "how to authenticate" threads which is not quite the issue I am experiencing.

v-yingjl
Community Support
Community Support

Hi @bbdiitmanager ,

Maybe you can clear the permissions in 'Data source and settings' in power bi desktop and try it again.

Also, you can refer these article and issue that hopes to help you too:

  1. Easiest way of connecting Power BI to a REST API with Oath2 authentication 
  2. 401 Unauthorized Error: What It Is and How to Fix It 
  3. HTTP 401 Unauthorized by using PowerBi rest api 

 

Best Regards,
Yingjie Li

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.