Forums

Authorize webhook from external website

Hello! I have my app in pythonanywhere that is password protected. I need to get API webhooks from an external website. I have tryed to set username:password@https://myapp.pythonanywhere.com/webhook but it's not working...the website gets 401 response. Locally it works. Any ideas?

Thanks very much!

Federico

You need to configure correctly whatever tool you are using to connect to your API. Take a look at https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication

I have a simple function in my main app script that catches the json from an incoming post request on the route "/webhook" I don't have any option to configure the website that sends me the request rather than a field where I can write my "listening" url. What do you mean by tool? Thanks

Federico

You are using some code to make that request. It can probably handle simple http authentication.

Hello, I'm not using code and not making a request, just handling an incoming request json provided by an external service (it notifies me when a certain event happens on a specific platform). However I've disabled the Pythonanywhere password protection option and wrote my own basic auth script to protect only certain area of the web app leaving the "/webhook" url free for external incoming requests.

Thanks!

Federico

Right. That makes sense. I misunderstood that you control the service that hits that webhook endpoint.