Skip to main content
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.

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

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


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.

Top Solution Authors
Top Kudoed Authors