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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Duftnich06
Regular Visitor

Power Query REST API Forgetting Settings

I've created a REST query that uses a bearer token, which it gets from a function I've created:
Function:

Duftnich06_1-1688547009228.png

Query:

Duftnich06_4-1688547366301.png


It refreshed fine for a while but then, after a certain amount of time, the refresh stops working and I get a 'can't authenticate using these credentials' message.
If I invoke my function it produces a new access token, so it can't be that. What I did was, go to my data source settings for the two queries, clear their permissions and then refresh again, ignoring privacy rules and they start refreshing again, without issue...
I can even clear permissions and set them to public and they refresh fine aswell!
With either solution, after a certain amount of time they stop working again and I have to repeat this exercise, clearing data source permisions and then refreshing them again, which is not helpful for the end client.

I created an Azure Datafactory pipeline, doing the same thing as Power BI and it worked for 3 days straight, refreshing every 15mins without issue, exporting to a JSON that I could import into Power BI. I also can replicate the REST API in Postman without any issues, leading me to believe the issue lies in Power BI somewhere.

Has anyone come accross this or have any dieas what is going on?
@ImkeF you've helped me before, any thoughts?

1 REPLY 1
Duftnich06
Regular Visitor

Update:
It appears to be the GetAccessToken() function that is causing the issue.
Essentially, if I stop it being a function, clear its permissions and then run it, setting the permissions on run time, it then returns a string happily. I then set it back to a function and then I can run everything else fine...weird!?
Any thoughts @ImkeF?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors