cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Robert76
New Member

On-Prem Gateway - Enterprise mode - oAuth2 authentication with refresh token

Hi,

 

We are using the on-prem gateway in enterprise mode with a custom connector to refresh an oAuth2 protected odata service. Each time you request a new access token from this service you also get a new refresh token and the previous refresh token is invalidated (this behaviour is optional in the oAuth2 RFC).

 

In the desktop version of Power BI refreshing data with our custom connector works just fine. The desktop version also seems to respect the expiration date of the access token.

 

However, using the gateway and the Power BI service, the expiration time of the access token seems not to be respected. The service always requests a new access token using the refresh token. The service also requests a new token for each source (even if they are part of the same connection). This results in multiple requests for new refresh tokens (almost simultaneously) that seem to cross each other, which results in the fact that the second, third, etc call is done with an already invalidated refresh token, which in turn results in an access denied by the oData service.

 

Why is the desktop version and the service behaviour different? Does anybody have experience with the same issues?

 

Thank you

 

Robert 

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @Robert76 

First which error do you meet?

 

Please follow this guide step by step

https://docs.microsoft.com/en-us/power-bi/service-gateway-custom-connectors

 

Pay attention to the consideration:

  • For custom connectors to work with the On-premises data gateway, they need to implement a “TestConnection” section in the custom connector’s code. This is not required when using custom connectors with Power BI Desktop. You can have one that works with the Desktop, but not with the gateway for this reason. Please refer to this documentation on how to implement a TestConnection section.

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
collabdays lisbon

CollabDays Lisbon - 26 November 2022

Sessions include practical, hands-on experience that will help you take the next step in your career and know-how.

Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.