ofLoadURL 401 Unauthorized Error

Hey oF community. I’m trying to send a command to a network camera on my local network. The brand of the camera is Axis if anyone is interested (they make great cameras!)

I have the correct http request which I can use to control the camera via a web browser like chrome:

This is a really simply command and it just deactivated a virtual port which I then use to control some other stuff on the camera.

Ideally I’d like to have an oF app which allows me to toggle this setting on the camera via a button so I’m using the following code to control it which should send the web request:


However this does not set the correct setting on the camera and returns the following as an HTTP response:

<title>401 Unauthorized</title>
<p>This server could not verify that you
are authorized to access the document
requested.  Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>

I’ve tried adding the username and password to the html request like so: But this still returns the same error (it’s worth noting this request also works in the browser).

I’m going to open a ticket with the camera supplier to see if the issue is something I can resolve via the request but it’s also possible that by using oF my “Browser” doesn’t know how to deliver the correct credentials.

Has anyone run in to something like this before or have any advice on how oF passes credentials to a web server?



I’m thinking this addon may have some good information in it:

I’ll have a look and report back.

Which OS do you use?
I had similar issue on Android recentry and solved by switching old version of curl lib.
But OS X or Win, Linux might not use curl, not sure…


You can use the post example in ofxHTTP to do this. You’ll likely need to include a basic authorization as well. I’ve used this library with axis came before and it works nicely.

Hrs, I’m using OS X actually but I can look in to the version of curl. Thanks for the insight!

Backercp i’ll check that out! I’m going to have a swing at this tomorrow and will report back as to how everything’s gone.

Thanks so much for the feedback guys!


1 Like

Hey guys,

Finally looked in to this and using ofLaunchBrowser with my desired URL works very well!

Only problem is it pops up a bunch of browser windows which is ok for now but would ultimately be good to avoid. Any idea how to close them immediately once I’ve gotten a response, or simply open them in the background?