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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
paulalmond91
Helper II
Helper II

OAuth2.0 Custom Connector TestConnection Issue

I've tested a working connector with PowerBI desktop and published this to service but I am facing an issue where the Data Source configuration in the Gateway won't store the OAuth access_token.
I following the guidance regarding TestConnection found here: https://github.com/Microsoft/DataConnectors/blob/master/docs/m-extensions.md#implementing-testconnec...

 

The issue I am facing is that I click Edit Credentials when configuring a Data Source on the gateway - the OAuth flow start and I click to Allow access but it just takes me back to the popup below (with Add being greyed out).

 

Capture.PNG

 

Here is my VS code:

 

 

[DataSource.Kind="AdministrateGraphQL", Publish="AdministrateGraphQL.UI"]
shared AdministrateGraph = (query as text) =>
    let
        apiToken = "Bearer " & Extension.CurrentCredential()[access_token],
        Source = Web.Contents("https://api.getadministrate.com/graphql",
        [Headers=[
			    #"Method"="POST",
			    #"Content-Type"="application/json",
                #"Authorization"=apiToken
		    ],
            Content=Text.ToBinary(query)
        ]),
		Output = Json.Document(Source)
    in
        Output;

[DataSource.Kind="AdministrateGraphQL"]
shared TestAdministrateGraph = (query as text) =>
    let
        apiToken = "Bearer " & Extension.CurrentCredential()[access_token],
        Source = Web.Contents("https://api.getadministrate.com/graphql",
        [Headers=[
			    #"Method"="POST",
			    #"Content-Type"="application/json",
                #"Authorization"=apiToken
		    ],
            Content=Text.ToBinary(query)
        ]),
		Output = Json.Document(Source)
    in
        Output;

// Data Source Kind description
AdministrateGraphQL = [
	TestConnection = (dataSourcePath) => { "AdministrateGraph", dataSourcePath },
    Authentication = [
        OAuth = [
            StartLogin=StartLogin,
            FinishLogin=FinishLogin,
            Refresh=Refresh
        ]
    ],
    Label = Extension.LoadString("Administrate GraphQL Connector") 
];

 

 

 

Is anyone able to highlight why this isn't working?

2 REPLIES 2
davidvincentret
Frequent Visitor

Hello, 

I am working on developping an Oauth2 connector like you but I'm currently not succeeding, would it be possible to see how you've set up your StarLogin and FinishLogin functions ? I'm struggling with these two functions because I don't need any authorize URL to access my toke, I just need to request the token url with some credentials and I get it, no exampe works like this online 

Otherwise sorry, I can't help you that much ahah

paulalmond91
Helper II
Helper II

Anyone have any thoughts?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.