Open ChamPain opened 3 years ago
What header did you specifically add as it could be getting overwritten? Provide the actual text you input. You can change the api key obviously though.
There may be more information in https://community.octoprint.org/t/hit-url-after-print-is-finished/30313
In my case, I want to call a node-red flow when the Print is started and finished to turn on and off the WLEDs I have installed. I can turn it on with the following call: http://username:password@192.168.1.1:1180/endpoint/ledon and another call when the print is finished: http://username:password@192.168.1.1:1180/endpoint/ledoff it is just a basic matter of making this URL call work with the webhook plugin.
I got it to work in OctoPrint's config.yaml and using events to call a script with those curl commands, but I thought it may have been easier with the webhooks plugin.
I don't know exactly what to put for the URL settings and how to call ledon and ledoff for the print started and print done events. When I have http://username:password@192.168.1.1:1180/endpoint/ in the URL box and do a test event I get an API error: Failed to parse: http://username:password/endpoint/
And I'm pretty sure I have the ledon and ledoff events incorrectly too
Edit: I was poking around the code and went to try again today and Basic auth works now by putting it in the header. The only thing I can think of is that I restarted my pi in the mean time. When I remove it from the header is still works so it may be an issue of something caching the auth?
It seems like the basic auth doesn't work in the plugin. I've tried doing the basic auth in the url like https://alan:testpass@example.com as well as adding a line to the headers section like "Authentication": "Basic YWxhbjp0ZXN0cGFzcw==" but keep getting the 401 unauthorized errors. I verified the url version and passing it in an explicit header and it works fine for both outside the plugin.
Below is my exact HEADERS input { "Content-Type": "application/json", "Authorization": "Basic YWxhbjp0ZXN0cGFzcw==" }
And I'm pretty sure I have the ledon and ledoff events incorrectly too
I believe you do. It looks like you want a ledon endpoint and a ledoff endpoint. To to that you need to use the "New Hook" button. What you've done is sent the text "/endpoint/ledon" and "/endpoint/ledoff" to a single endpoint defined in URL. In your node-red http node it will say something like "The url will be relative to /path." and you've filled in the http node URL box with something like "/ledon". So in the webhook plugin you'd put "http://yourserver:1880/path/ledon" and when a print is started is will send whatever text is in the PRINT STARTED box to the ledon endpoint.
I now ran into this basic auth issue with a Shelly Plug S and @pete1450's suggestion about putting the Base64 encoded username:password into the header also worked for me. However, I'm not seeing any caching effects on my setup since the test event goes back to returning a 401 as soon as I remove the basic auth info from the header again.
Would still be great if basic auth were directly supported in the plug-in, ideally via corresponding textboxes for entering the username and password.
Hi, using node-red within home-assistant requiring basic auth.
as basic auth is not an option in the settings, I simply added the according custom header, but still get unauthorized from the API. Tested the same header with Postman successfully and also checked that the header is right by generating it "regularly" in postman (using basic auth setting and comparing the generated header)
best regards Christian