der_micha
(Michael)
February 11, 2021, 9:22am
#1
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.
der_micha
(Michael)
February 11, 2021, 11:01am
#4
Thanks, but Basic Authentication is already enabled:
I wrote nonsense. Ignore this post.
icompas
(Immo)
February 11, 2021, 12:16pm
#6
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
opus
(Jürgen Baginski)
February 11, 2021, 3:10pm
#8
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
der_micha
(Michael)
February 11, 2021, 8:10pm
#10
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).