Showing results for 
Search instead for 
Did you mean: 
New Member

PBI Custom Connector w OAuth2 grant_type client_credentials fails to refresh data


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 (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 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:
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 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 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

New Member

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

Helpful resources

PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors