Forum Discussion
How to refresh using REST API with OAuth2
- 10 years ago
Hi,
As you guessed, refreshing data with OAuth2 authentication is not yet supported in Power BI. Editing credentials in the PowerBI.com service will require the service to know how to direct you to the OAuth login page, capture and store the access token credentials from the redirect URL and refresh the token when necessary, none of which the service know how to do today with the tooling available to you.
It seems like you have been trying to work around some of those things by writing your custom code, but it might be really hard to have a working end to end solution that way.
The good news is that this is something on the team's radar and is in the pipeline. No solid dates or ETAs at the moment, but expect to hear more announcements in this area in the future.
Hi,
As you guessed, refreshing data with OAuth2 authentication is not yet supported in Power BI. Editing credentials in the PowerBI.com service will require the service to know how to direct you to the OAuth login page, capture and store the access token credentials from the redirect URL and refresh the token when necessary, none of which the service know how to do today with the tooling available to you.
It seems like you have been trying to work around some of those things by writing your custom code, but it might be really hard to have a working end to end solution that way.
The good news is that this is something on the team's radar and is in the pipeline. No solid dates or ETAs at the moment, but expect to hear more announcements in this area in the future.
Could someone speak to two issues here:
Refreshing published data that use parameterized functions in their queries. Is this a bug or a known limitation?
And custom solutions for the current implementations of oauth. Using power query we can implement it quite easily ourselves (with heavy scripting) and I'm kind of curious about the same issue the OP was having. We don't want to get the oauth token every time and we need to keep track of when it expires so that we can get it again. Does anyone have any ideas if this is possible and how to do that?
- Youssef9 years agoMicrosoft Employee
I'm not sure I understand your first question regarding parameterized functions. Can you elaborate a bit more or share an example?
As for auto refreshing the token for OAuth, there is no easy way today to achieve that. We are working on some extensibility capabilities for Power BI Desktop that should enable this scenario, but there is no ETA at the moment. However, we are shooting for the first half of 2017.
- jkbrookes9 years agoFrequent Visitor
Is there a hard way to refresh the oauth token? I figure I need a way to update a variable of some sort that exists in some global capacity.
The OP mentioned that he had read in the forums that having functions which take parameters means that published reports that use those functions will cause it not to work. I think I have seen something similar with my own reports but did not realize that that could be the problem.
For example, I have a "GetAPI" function that you pass the url of the api that I want to access to (such as, GetAPI("/10001/devices/search")). When I publish that report which uses that function the refresh will not work from the website.