Skip to main content

Notifications

Community site session details

Community site session details

Session Id : hAjrZ5dkkHSu7Crtf97xZr
Power Automate - Connector Development
Unanswered

Custom Connector with Code enabled always returns Error 403 Forbidden

Like (0) ShareShare
ReportReport
Posted on 12 Sep 2022 08:56:54 by 39

Hello everyone,

 

I am trying to create a custom connector and to change the request's content with the avail of the "Code" functionality. 

 

However, it does not work. I have been trying for days to send a request to one of my Web Services, which works perfectly and can be accessed without any issue outside of Power Platform. When enabling custom code, the connector will always return a 403 forbidden error no matter what.

 

In the end I decided to copy and paste the code in the Microsoft Documentation example, hoping that maybe it was something I was doing wrong, but apparently even Microsoft's own code does not work and returns that same 403 Forbidden error with an empty body. 

 

So I thought, that is not possible, my web service is well made, it works, and it is made in a way that it would return a proper error message in order to allow me to debug what is going on. So it appeared clear to me that that response was not returned by MY web service, but it is certainly coming from somewhere else. 

 

So the questions are, is there any way to understand what is going on? Why do I receive a forbidden 403 Error inside the Connector Test tab without any body whatsoever? Which resource is receiving my data and answering?

 

Thanks in advance,

have a lovely day.

  • stepello Profile Picture
    19 on 23 Aug 2023 at 04:48:18
    Re: Custom Connector with Code enabled always returns Error 403 Forbidden

    I fixed the problem. In case of custom connector it was enough to go into Edit and then just Update the connector. Maybe in case of prebuilt connectors it is enough to reauthenticate them or remove and add them again. It would seem that many Azure related connectors sort of disconnected couple days ago.

  • stepello Profile Picture
    19 on 22 Aug 2023 at 12:26:49
    Re: Custom Connector with Code enabled always returns Error 403 Forbidden

    @Perneel I actually started experiencing this issue as well. Funny enough last week custom connector was working just fine. And it is not just one custom connector. I have the same one on other environments within organization and one more on the same environment. All of them stopped working and are returning 403 error. @Kaif_Siddique is it possible that something was changed this week by Microsoft that could cause the issue?

  • Perneel Profile Picture
    6 on 22 Aug 2023 at 10:46:41
    Re: Custom Connector with Code enabled always returns Error 403 Forbidden

    @Kaif_Siddique Did you ever found the cause of this issue? I'm experiencing the exact same problem at this moment. Also tried the same steps as you did, but I'm still running against a 403 error. With the Code disabled, it works.

  • DennisPreatto Profile Picture
    39 on 13 Sep 2022 at 19:27:19
    Re: Custom Connector with Code enabled always returns Error 403 Forbidden

    Hello @Kaif_Siddique ,

    I am aware of the possible causes of a 403 Error, and none of those apply to my scenario. In this case, the session is authenticated by the parameters provided in the "Security" tab of the Custom Connector Setup, which is set to basic. The credentials are then provided in the connection which is created in the "Test" tab.

     

    I suppose that, even if there is custom code enabled, those credentials are used anyway to authenticate to the web server. When debugging from the web server (listening for incoming requests) there are no incoming requests, so I suppose that my web server is not the actual recipient of the data, when enabling custom code.

     

    Even using the "forwarding script" shown in the documentation:

    var response = this.Context.SendAsync(this.Context.Request, this.CancellationToken) ...

    that from my understanding is just taking the request and forwarding the request to the API endpoint without doing anything else, is not working at all and returning a 403 Error.

     

    Any other suggestion will be greatly appreciated,

     

    thanks, have a nice evening.

  • Kaif_Siddique Profile Picture
    2,104 Super User 2024 Season 1 on 12 Sep 2022 at 19:31:38
    Re: Custom Connector with Code enabled always returns Error 403 Forbidden

    Hi @DennisPreatto ,

     

    403 Forbidden status code means that the client credentials (access token) are valid but refuses to authorize it.

     

    Following are the possible reasons:

    • User is not authorized to access the resources
    • Access token is expired
    • Authorization server revoked access

     

    Check the API documentation or work with the owner/administrator to resolve this issue.

     

    If you like my response, please give it a Thumbs Up.
    If this helps, please Accept as solution.


    Regards
    Kaif

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Connector Development

Overall leaderboard

Featured topics

Loading started