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
smeneg
New Member

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
New Member

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.

 

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.