cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
smeneg Frequent Visitor
Frequent Visitor

Microsoft.Data.Mashup.CredentialError.Reason CredentialInvalid

Hi, 

We are developin a custom data connector to connec to through a custom WEB API to a SaaS application.

The Authentication type is similar to the github example i.e. OAuth2

 

XXX = [
     TestConnection = (dataSourcePath) => { "XXX.Contents" },
    Authentication = [
        OAuth = [
            StartLogin = StartLogin,
            FinishLogin = FinishLogin,
            Logout = Logout,
            Label = Extension.LoadString("AuthenticationLabel")
        ]
    ],
    Label = Extension.LoadString("DataSourceLabel"),
    SupportsEncryption = true
];

From Power BI Desktop everyting works fine.

These days we are moving to the Pro features where we publish the dataset and or reports that have been developed using data from our XXX connector (ONLY from this source).

 

We have downloaded and succesfully installed the latest version of the On Premises Gateway (not the personal one).

We have succesfsfully setup the connection, the datasource as shown in the figure belowpbi01.jpg

 

At the datasource part of the service we have the status as shown in the following screenshot:

pb02.jpg

 

And the error we got from both refresh and scheduled refresh is the following:pb03.jpg

 

 

At the custom connector code level all the calls to the api are using the access_token like in the example below:

WebAPI_GetTopLevelMenu = ()  =>
    let 
        ebsCommand = "asset",
        params = Uri.BuildQueryString([routeId = "PBZ.json"]),
        skey = Extension.CurrentCredential()[access_token],
        url = Uri.Combine(apiURL, apiCommand) & "?" & params,
        wb = Web.Contents(url, [Headers = [#"Authorization" = "Bearer " & skey]]),
        tb = Text.FromBinary(wb),
        js = Json.Document(tb)
    in
        js;

Like I said, when running fvrom Power BI Desktop everything works fine (OAUTH sign in, execution of api cals leading to fetching data, etc.

Can someone please give me a direction on how to "debug" the error ?

Is it due to the gateway? due to the connector?

 

Regards,

Stavros

1 REPLY 1
smeneg Frequent Visitor
Frequent Visitor

Re: Microsoft.Data.Mashup.CredentialError.Reason CredentialInvalid

One more clue:

 

I changed the custom data connector code 

XXX = [
     TestConnection = (dataSourcePath) => { "XXX.Contents" },
    Authentication = [
        OAuth = [
            StartLogin = StartLogin,
            FinishLogin = FinishLogin,
            Logout = Logout,
            Label = Extension.LoadString("AuthenticationLabel")
        ]
    ],
    Label = Extension.LoadString("DataSourceLabel"),
    SupportsEncryption = false
];

To NOT Support encryption and the refresh works fine. So the question is what should a custom data connector developer do in order for his/her code to work with encrypted connections?

I though that the encryption / decryption will be handled by the service / gateway and that the custom data connector should not be ware of the calling context.