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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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