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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
nmusters
Regular Visitor

Writing to a parameter (OAuth tokens)

Hi,

So I'm currently constructing a dashboard that uses multiple OAuth endpoints. For context: I have a table of ID's and for each ID I want to check a number of endpoints what the data for that ID is. Because PowerBI doesn't support OAuth I get an refreshtoken using Postman which I feed to PowerBI and use it to get an accesstoken. My problem is the API I use has a accesstoken expiration of 10 minutes and also a limit of the amount of API calls per second causing my accesstoken to expire before the entire table is loaded.

 

Making things difficult is that each time I get an accesstoken, I also get back a new refreshtoken. The solution I came up with would be to store the new refreshtoken to a parameter so I can later use it to get a new accesstoken. However is it possible to do such a thing? Am I approaching this from a completely wrong angle? Or should I rewrite the entire thing to sql or python?

 

Thanks in advance for any help!

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee


@nmusters wrote:

Hi,

So I'm currently constructing a dashboard that uses multiple OAuth endpoints. For context: I have a table of ID's and for each ID I want to check a number of endpoints what the data for that ID is. Because PowerBI doesn't support OAuth I get an refreshtoken using Postman which I feed to PowerBI and use it to get an accesstoken. My problem is the API I use has a accesstoken expiration of 10 minutes and also a limit of the amount of API calls per second causing my accesstoken to expire before the entire table is loaded.

 

Making things difficult is that each time I get an accesstoken, I also get back a new refreshtoken. The solution I came up with would be to store the new refreshtoken to a parameter so I can later use it to get a new accesstoken. However is it possible to do such a thing? Am I approaching this from a completely wrong angle? Or should I rewrite the entire thing to sql or python?

 

Thanks in advance for any help!


@nmusters

In my case, the lifetime of refreshtoken is 14 days by default and the new refreshtoken doesn't make the old expired. For Oath2 authentication, I only worked with Azure AD and the max lifetime of refreshtoken can be as long as 90 days. It is acceptable for me to manually update the pbix every 3 months.

 

For your case, or say for any case, in my opinion, it is not a good practice to handle duplicated authetication/REST API scenario in Power Query, I'd suggest you rewrite the entire thing in python, save the data to some file or database. Then connect to the file/db from Power BI.

 

View solution in original post

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee


@nmusters wrote:

Hi,

So I'm currently constructing a dashboard that uses multiple OAuth endpoints. For context: I have a table of ID's and for each ID I want to check a number of endpoints what the data for that ID is. Because PowerBI doesn't support OAuth I get an refreshtoken using Postman which I feed to PowerBI and use it to get an accesstoken. My problem is the API I use has a accesstoken expiration of 10 minutes and also a limit of the amount of API calls per second causing my accesstoken to expire before the entire table is loaded.

 

Making things difficult is that each time I get an accesstoken, I also get back a new refreshtoken. The solution I came up with would be to store the new refreshtoken to a parameter so I can later use it to get a new accesstoken. However is it possible to do such a thing? Am I approaching this from a completely wrong angle? Or should I rewrite the entire thing to sql or python?

 

Thanks in advance for any help!


@nmusters

In my case, the lifetime of refreshtoken is 14 days by default and the new refreshtoken doesn't make the old expired. For Oath2 authentication, I only worked with Azure AD and the max lifetime of refreshtoken can be as long as 90 days. It is acceptable for me to manually update the pbix every 3 months.

 

For your case, or say for any case, in my opinion, it is not a good practice to handle duplicated authetication/REST API scenario in Power Query, I'd suggest you rewrite the entire thing in python, save the data to some file or database. Then connect to the file/db from Power BI.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.