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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.