OH3 - rest api http request with authentication

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

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

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

:face_with_raised_eyebrow:
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:

sendHttpGetRequest(“http://user:password@192.168.0.48:8080/rest/things/innogysmarthome:bridge:xxx”)

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