OH3 - rest api http request with authentication

in OH 2.5x i have a rule to check if bindings are online or offline, for example:

Thing "innogysmarthome:bridge:SMARTHOME09" received update or
System started
var response = sendHttpGetRequest("http://xxx.xxx.xxxx.x:8080/rest/things/innogysmarthome:bridge:SMARTHOME09")
var String status= transform("JSONPATH", "statusInfo.status", response)

When i try this in OH3, i get the following error:

{“error”:{“message”:“Authentication required”,“http-code”:401}}

How can i submit my user credentials in a rule in OH3?
I tried http://user:password@xxx.xxx.xxx.x but this didn’t work.

Thanks in advance for any help.

This might solve your issues

If you want to use Basic auth you have to enable it in the settings.

Thanks, but Basic Authentication is already enabled:

I wrote nonsense. Ignore this post.

Struggling with the same issue.

  • checked basic authentication
  • unchecked ‘implicite user role’

FF is now concerned that I send a user:password, and even though confirming that this is ok,
I receive also,

{"error":{"message":"Authentication required","http-code":401}}

Can you show the request you are making (with dummy pw/user)?
If it is in the form http://user:pw@oh_host:oh_port/rest.. it should definitely work

I’m using Basic Authentication and have the “Impicit user role…” checked to ON. With those settings my REST calls via a rule are working!

Yes - it works and correct setting is implicit user role to on.
Sorry - I was confused.

The problem is probably a typo in the url :wink:

I still get the error:

{“error”:{“message”:“Authentication required”,“http-code”:401}}

My request:


What could be wrong with this url? In OH 2.5 this is working fine (without user credentials).