Forum Discussion
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:09ZIf 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
- NemElNew Member
Can you post the code for custom connector with client_credentials please as cant find one on the internet