cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

Accepted Solutions
Microsoft
Microsoft


@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
Microsoft
Microsoft


@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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors