Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Regular Visitor

Custom Connector OAuth | 404 when using gateway and

I have setup a custom connector that using OAuth2 authentication however I'm having issues trying to get this to authenticate on via a personal or enterprise gateway.

The connector successfully authenticates when using it with Power Bi desktop however as soon as I publish the report and try to setup authentication for the dataset, I get a 404 not found error returned as below.




The code returned by the OAuth2 service is quite long, between 4000-5000 characters. Is there a query or URL length limit for the redirect_uri

I did some testing with my own OAuth2 server and as soon as the authorization code exceeded about 4200 characters, I started getting the same issue.

Regular Visitor

Hello @v-jayw-msft ,


I have implemented the test connection.

I built two identical custom connectors with the only difference being the OAuth2 server used to authenticate and as soon as the authorization code returned by the OAuth2 server exceeded around 4200 characters, I get the 404 error otherwise I can use them perfectly fine with the on-premises data gateway.


It appears there is some limit to the length of the code that the Power Bi redirect uri can handle.


The issue here is that the service provider is unable to change the length of the code returned and from what I can work out, the OAuth2 specification doesn't specify a limit to code therefore this is within specification.


After raising an issue with Microsoft Power Support, this is the place they told me to come as apparently they don't handle these issues.


Are you able to point me in the right direction to get this issue sorted?



Community Support
Community Support

Hi @ubt_luke ,


OAuth for custom connectors via gateways is currently supported only for gateway admins but not other data source users.

The method for implementing TestConnection functionality is likely to change while the Power BI Custom Data Connector functionality is in preview.

To support scheduled refresh through the on-premises data gateway, your connector must implement a TestConnection handler.

For more details, please check this document. 


Best Regards,


Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Helpful resources

PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors