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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Refresh not working for OAuth based Custom Connector in Power BI Service

Hi, we developed a custom connector for Power BI. It works fine perfectly in Power BI desktop. But, it doesn't work so in Power BI service. Both Manual and Scheduled reason fails for anonymous reason and atleast if the refresh log had a clearer note. We could have debugged the error. 

Things we did :

1. Read an answer stating the need for "TestConnection" which is already set in our connector.

2. Cross checked data gateway which is also perfectly fine

3. Looked for solutions across the community but couldn't find any solution that could resolve our issue. 

 

Hence, kindly anyone who has faced this issue and has overcome it successfully kindly throw us some light on crossing this issue. 

Thanks in advance!

10 REPLIES 10
dbeavon3
Memorable Member
Memorable Member

This has been biting us for five years, and will probably be biting us for another five years.

I have learned that it is a known issue that oauth access tokens will not be refreshed in the enterprise gateway. Oddly the tokens are refreshed successfully within the PBI desktop environment. Just not in the gateway.

 

If a developer creates a custom connector that works fine in the desktop, they should be able to assume it will work fine in the enterprise gateway as well. It is very frustrating to spend so many weeks digging into this, only to find out that it is a known issue for which a fix hasn't been prioritized yet:

https://docs.microsoft.com/en-us/power-bi/connect-data/refresh-troubleshooting-refresh-scenarios#ref...

 

"Microsoft is investigating a solution that allows the data loading process to refresh the token and continue.."



Given the fact that this "AAD" auth-kind is using Microsoft's own identity services, you would expect a Microsoft product would not have a compatibility/interop problem!

EHP
Advocate I
Advocate I

Hi everyone! 

 

I found the answer here:
https://community.powerbi.com/t5/Report-Server/Query-contains-unsupported-function-Function-name-Web...

 

Essentially my query needed splitting into base url and relative path.  I was still able to keep a variable in the base url, which made environment switching much easier.  This is an edited code snippet:

environmentName = "dev1"

GetJobsData = ((offsetAmount as number) as record =>
let
    Source = Json.Document(Web.Contents("https://" & environmentName & "myURL.net",
    [
        RelativePath = "api/jobs" & "?offset=" & Number.ToText(offsetAmount)
    ]))
in
    Source),

Hope this helps!

EHP
Advocate I
Advocate I

Bump any progress @v-joesh-msft ?  Getting the same error.

Anonymous
Not applicable

Same error for me.

Did you find any solution?

Same error for me. I checked the fiddler traffic and it appears that the api is returning the information I'm requesting through the custom connector, but Power BI Service isn't taking it in for whatever reason. Works perfectly find in Power BI Desktop. Anyone have any luck?

I'm stuck at exactly the same point. My custom connector for Google Spreadsheets works great in PowerBI Desktop, but in PowerBI Service both manual and scheduled refresh are causing problems.
I can set up the gateway connection for my uploaded report in PowerBI Service, enter my Oauth2 credentials and schedule a refresh without problems. However, at the scheduled refresh time or when manually refreshing, Service is showing the following error:

{"error":{"code":"DM_GWPipeline_Client_OAuthTokenRefreshFailedError","pbi.error":{"code":"DM_GWPipeline_Client_OAuthTokenRefreshFailedError","parameters":{},"details":[],"exceptionCulprit":1}}} 

 

I'm also having a tough time finding how to resolve this. Has anybody managed to fix this?
If it helps, I can post my connector code - let me know.

Anonymous
Not applicable

bump, am also running into this...

 

https://i.imgur.com/oJnGkT3.png

v-joesh-msft
Solution Sage
Solution Sage

Hi @Anonymous ,

1. Try to check your desktop version, update it to the latest version, and republish to service.
2. Try Use personal gateways in Power BI

3. Here is a similar post, you can refer to: Error while refreshing data from custom connector

Best Regards,

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

Anonymous
Not applicable

Hi @v-joesh-msft

I checked your steps but couldn't find any solution. I also explored the gateway logs and found the actual error. It says DM_GWPipeline_Client_OAuthTokenRefreshFailedError which basically is failure of oauth token refresh. I found the reason, but couldn't find any solution. Any help to this is largely appreciated. Thanks!

Microsoft updated a page to say that oauth2 tokens expire after an hour in the gateway.

 

https://docs.microsoft.com/en-us/data-integration/gateway/service-gateway-onprem-faq#why-do-i-get-th...

 


This is buggy behavior. And it is very different than what we experience in the PBI desktop. Ideally the enterprise gateway would work better than the PBI desktop, rather than worse.

Based on the inspection of the underlying code, the AAD tokens are supposed to be refreshed. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.