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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

PBI Custom Connector w OAuth2 grant_type client_credentials fails to refresh data

Hi,

We have built a Custom Connector using Power Query SDK the to be able to use a vendor system as a data source in Power BI.

We need this because the REST API from the system uses OAuth V2 with the Grant type “Client Credentials”

 

Here’s where our implementation differs from all the examples found online, where all OAuth examples use the Grant type “Authorization code”

 

Anyhow, the implementation works using Power BI Desktop locally, and also works online on powerbi.com (through a On-premise Data Gateway) on the first try and the following tries as long as the Access token has not expired.

 

But if you try to refresh either manually or by scheduler an hour after the initial setup, when the Access Token has expired, the online service doesn’t seem to understand that it has expired and requests a new one. Instead it gets an error when trying to connect to the datasource.

 

The error message under “Dataset” in powerbi.com reports the following:

Something went wrong
Invalid connection credentials.

Please try again later or contact support. If you contact support, please provide these details.
Underlying error code: -2147467259 Table: journal.
Underlying error message: The credentials provided cannot be used for the Vendorsystem source. (Source at Vendorsystem .)
DM_ErrorDetailNameCode_UnderlyingHResult: -2147467259
Microsoft.Data.Mashup.CredentialError.DataSourceKind: Vendorsystem
Microsoft.Data.Mashup.CredentialError.DataSourcePath: Vendorsystem
Microsoft.Data.Mashup.CredentialError.Reason: CredentialInvalid
Microsoft.Data.Mashup.MashupSecurityException.DataSources: [{"kind":"Vendorsystem ","path":"Vendorsystem "}]
Microsoft.Data.Mashup.MashupSecurityException.Reason: CredentialInvalid
Cluster URI: WABI-EUROPE-NORTH-B-redirect.analysis.windows.net
Activity ID: 8bf0a164-83f9-4928-9e0c-f493249a6d7b
Request ID: 9960c0f8-540c-437d-87ba-7f7f28d1ef29
Time: 2019-06-16 22:18:09Z

If I at this point once again on powerbi.com go to Settings – Manage Gateways – Edit Credentials – Sign in and changes the name to enable the “Apply” button, it works for another hour.

 

My conclusion is that stated above, that the token acquired gets expired after an hour, but powerbi.com does not try to login again to get a new one.

Troubleshooting this in any deeper extent on my end is hard since most of the requests are made from the cloud service itself.

 

The Vendor System does not implement a "Refresh Token", which is an optional method in the SDK

1 REPLY 1
NemEl
New Member

Can you post the code for custom connector with client_credentials please as cant find one on the internet

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors