Page 1 sur 3

Json Authentification

Publié : 03 nov. 2023, 11:31
par yann500
Bonjour,

Depuis la mise a jour avec la version 2023.2 je n arrive plus a envoyer un script json depuis mon navigateur sans etre authentifié.
Comme par exemple recuperer le status d un capteur, j ai une erreur 401:
http://username:password@192.168.0.X:80 ... es&rid=620

Dans Domoticz j ai bien activé
Autoriser l'authentification Basic-Auth sur du pur HTTP
et mis un password.
J ai aussi passé dans l'adresse ci dessus username:password encripted mais tjrs error 401.

Par avance merci.

Re: Json Authentification

Publié : 03 nov. 2023, 12:27
par Keros
Ta commandes n'est plus correcte suite au derniers changements de version : [MAJ] Stable DomoticZ 2023.2 : INFOS et CONSIGNES A SUIVRE

Re: Json Authentification

Publié : 03 nov. 2023, 12:46
par yann500
Merci pour votre reponse, effectivement je n'ai pas collé la bonne commande mais j'ai le meme resultat avec cette commande:

http://username:password@192.168.0.X:80 ... getdevices

Merci.

Re: Json Authentification

Publié : 03 nov. 2023, 13:12
par Neutrino
Bonjour,
C'est l'authentique qui pêche
https://www.domoticz.com/wiki/Domoticz_ ... horization

Re: Json Authentification

Publié : 03 nov. 2023, 13:47
par yann500
Bonjour Neutrino,

Pourtant ca correspond a ceci :

WARNING: from Stable 2023.1 and up API URLs with username and password as parameters are not supported anymore!! Use https://username:password@IP:PORT/json.htm instead.

Merci.

Re: Json Authentification

Publié : 03 nov. 2023, 18:59
par pierrotori
tu parles au début de username and password encrypté mais pour moi ils ne le sont pas

Re: Json Authentification

Publié : 03 nov. 2023, 19:06
par Neutrino
First the username and password are combined into one string "username:password"
This string is encoded using the RFC2045-MIME version of base64
The authorization method and a space i.e. "Basic " is then put before the encoded string.
This results in a header in the following format:

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
How the header is send differs per programming language. Check the documentation of the language of your choice on how to set http request headers.
Après, il a aussi les réseaux de confiance à mettre à jour dans les paramètres.

Re: Json Authentification

Publié : 03 nov. 2023, 19:10
par pierrotori
juste pour confirmation il faut bien que la "Protection API" soit décochée pour avoir le maximum de protection ?

Re: Json Authentification

Publié : 03 nov. 2023, 19:54
par yann500
domoticz.JPG
domoticz.JPG (109.72 Kio) Consulté 768 fois
Je ne vois vraiment pas ce qui pose probleme.

Json Authentification

Publié : 03 nov. 2023, 20:52
par pierrotori
tout depend si utilises domoticz en https de l’extérieur:
domoticz envoie de l’extérieur le http/https du dispositif
une application externe envoie un https