json url with username and password Topic is solved

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
Rebecca
Posts: 4
Joined: Wednesday 16 September 2020 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

json url with username and password

Post 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?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: json url with username and password

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Rebecca
Posts: 4
Joined: Wednesday 16 September 2020 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: json url with username and password

Post by Rebecca »

Thanks Waaren. I tried the same, doesn't work for me. Also tried it in different browsers :( .
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: json url with username and password

Post 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 2788 times
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Rebecca
Posts: 4
Joined: Wednesday 16 September 2020 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: json url with username and password

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: json url with username and password

Post 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?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Rebecca
Posts: 4
Joined: Wednesday 16 September 2020 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: json url with username and password

Post 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?
ThomasZA
Posts: 2
Joined: Friday 20 May 2022 23:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: json url with username and password

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest