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

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

Reply
Mornagli
Helper III
Helper III

How to integrate MPBI with source that have refresh tokens?

Hello, i need to integrate my MPBI with another source that have api with 'refresh token' that i need to refresh every X minutes.

 

There is a way i can do it with MPBI? Maybe there is some feature that i can write code in MPBI, and if so, there is option for crone that will run automatically?

Thnak you.

5 REPLIES 5
lbendlin
Super User
Super User

Are you planning to have a Direct Query connection?  In Import mode you won't need the refresh token if your data ingestion takes less than the x minutes. 

HI @lbendlin, I just need to import data, but my source need to refresh the keys to the API every X time, the refresh is not case of MPBI...

Write a pagination script in Power Query that refreshes the token after every x pages.  If you want to brute force it you can refresh your token before each page pull - but I am sure the API endpoint will not be happy about that.

@lbendlin thanks for the reply,


Let me explane myself again:
To fetch data from the API i need Key that i have, the problem is that after few houers i need to replace this KEY, I know how to replace the key in PYTHON, If i will make python script that first -> check if the KEY is no longer relevant and replece it and only then fetch the data, Is it possible to write it inside MPBI? And if so, if the data will be on the service, the script will still work?

Thnak you.

You are supposed to use proper session authentication when you run your Power BI scripts. You are not supposed to leech off an existing bearer token that you borrowed from an existing session that may expire at will.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.