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.
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.
@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?
@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.
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.
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:
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