Page 1 of 1

json url with username and password

Posted: Wednesday 16 September 2020 17:26
by Rebecca
In domoticz, I created a virtual switch, and set on action to trigger another virtual switch to turn on using json. Something like: http://192.168.1.2:8080/json.htm?type=c ... &svalue=79.

After I added username and password, this url is of course not working anymore.

Following the instructions in https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s, I tried:
- http://<user:pwd>@hostname
- http://domoticz-ip<:port>/json.htm?username=<encrypted username>&password=<encrypted pwd>&api-call

But both of the methods give me a 401 unauthorized error.

Somebody could help here?

Re: json url with username and password

Posted: Wednesday 16 September 2020 20:39
by waaren
Rebecca wrote: Wednesday 16 September 2020 17:26 I tried:
- http://<user:pwd>@hostname
- http://domoticz-ip<:port>/json.htm?username=<encrypted username>&password=<encrypted pwd>&api-call

But both of the methods give me a 401 unauthorized error.
Below call works for me

Code: Select all

http://waaren:[email protected]:8084/json.htm?type=command&param=getversion

Re: json url with username and password

Posted: Thursday 17 September 2020 12:04
by Rebecca
Thanks Waaren. I tried the same, doesn't work for me. Also tried it in different browsers :( .

Re: json url with username and password

Posted: Thursday 17 September 2020 12:27
by waaren
Rebecca wrote: Thursday 17 September 2020 12:04 Thanks Waaren. I tried the same, doesn't work for me. Also tried it in different browsers :( .
How did you configure your website protection? Mine is
protection.png
protection.png (60.94 KiB) Viewed 2846 times

Re: json url with username and password

Posted: Friday 18 September 2020 11:22
by Rebecca
I configure the website protection the same as yours.

waaren wrote: Thursday 17 September 2020 12:27
Rebecca wrote: Thursday 17 September 2020 12:04 Thanks Waaren. I tried the same, doesn't work for me. Also tried it in different browsers :( .
How did you configure your website protection? Mine is
protection.png

Re: json url with username and password

Posted: Friday 18 September 2020 11:27
by waaren
Rebecca wrote: Friday 18 September 2020 11:22 I configure the website protection the same as yours.
And does this user have admin rights?

Re: json url with username and password

Posted: Tuesday 29 September 2020 11:28
by Rebecca
Indeed, this was the problem. I added the user as admin, and now it works. Thanks a lot!
waaren wrote: Friday 18 September 2020 11:27
Rebecca wrote: Friday 18 September 2020 11:22 I configure the website protection the same as yours.
And does this user have admin rights?

Re: json url with username and password

Posted: Friday 20 May 2022 23:54
by ThomasZA
I have the same issue, tried both auth types... with and without admin rights on the user....

My local access works... my access using the same URL's from my phone (not on my wifi) works fine....

using the same auth either from ifttt or friends in another country does not work... 401 error

Not too sure what else to try - it used to work before (granted a long time ago - and I am only looking at it now)
So something must have changed in how domoticz handles these json url's, or its security then?