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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Kudoed Authors