ich implementiere aktuell die Loxone-Authentifizierung in Python anhand der offiziellen Doku „Communicating with the Miniserver“ und hänge beim JWT-Token.
Setup:
- Miniserver: 16.1.11.6
- Zugriff lokal über HTTPS
- Verschlüsselte HTTP-Requests via /jdev/sys/enc/... selbst implementiert (AES + RSA)
---
### Was funktioniert
Verschlüsselte Requests funktionieren sauber:
- /jdev/sys/getPublicKey → OK
- /jdev/sys/getkey2/{user} → OK (auch verschlüsselt)
Beispiel (verschlüsselt):
→ HTTP 200
→ key, salt, hashAlg werden korrekt geliefert
Das bestätigt:
- AES-CBC + ZeroBytePadding korrekt
- RSA Session Key korrekt
- enc-Aufbau korrekt
---
### Problem
Der JWT-Request:
/jdev/sys/getjwt/{hash}/{user}/{permission}/{uuid}/{info}
→ immer:
HTTP 401 Unauthorized
---
### Hash-Berechnung
Ich mache exakt:
pwHash = HASH(password + ":" + salt).upper()
authHash = HMAC(user + ":" + pwHash, key)
Getestet mit:
- SHA1 und SHA256 (je nach hashAlg)
- key aus getkey2 (hex → ASCII)
- alternative Interpretationen des keys:
- ASCII aus Hex
- Hex direkt als Bytes
- binär aus innerem Hex
→ alle Varianten liefern 401
---
### Weitere Tests
- mehrere User getestet (inkl. Admin)
- Passwort sicher korrekt (Login möglich)
- permission = 2 und 4 getestet
- UUID exakt wie in Doku:
098802e1-02b4-603c-ffffeee000d80cfd
- info = einfacher String ("Python Test")
---
### Wichtiger Punkt
Ein verschlüsselter Test-Call auf:
/jdev/sys/getkey2/{user}
funktioniert einwandfrei → Encryption selbst ist OK
---
### Frage
Hat jemand den JWT-Flow auf einem 16.x Miniserver erfolgreich umgesetzt und kann bestätigen:
1. Wie der `key` aus getkey2 exakt für den HMAC zu interpretieren ist?
2. Ob sich bei getjwt in neueren Versionen etwas geändert hat?
3. Ob es bekannte Probleme mit bestimmten Usern oder Settings gibt?
---
Ich vermute aktuell, dass entweder:
- die Doku an der Stelle nicht eindeutig ist (key-Interpretation)
- oder sich das Verhalten bei getjwt geändert hat
Bin für jeden Hinweis dankbar 👍
Gruß
Patrick
Hi everyone,
I am currently implementing authentication against a Loxone Miniserver using Python based on the official “Communicating with the Miniserver” documentation.
Environment:
- Miniserver: 16.1.11.6
- Local HTTPS connection
- Encrypted HTTP requests implemented manually (AES + RSA)
---
### What works
Encrypted requests are working correctly:
- /jdev/sys/getPublicKey → OK
- /jdev/sys/getkey2/{user} → OK (also when encrypted)
Example (encrypted):
→ HTTP 200
→ key, salt, hashAlg returned correctly
This confirms:
- AES-CBC + ZeroBytePadding implemented correctly
- RSA session key exchange works
- enc request structure is correct
---
### Problem
The JWT request:
/jdev/sys/getjwt/{hash}/{user}/{permission}/{uuid}/{info}
always returns:
HTTP 401 Unauthorized
---
### Hash calculation
I am using exactly:
pwHash = HASH(password + ":" + salt).upper()
authHash = HMAC(user + ":" + pwHash, key)
Tested with:
- SHA1 and SHA256 (depending on hashAlg)
- key from getkey2 (hex → ASCII)
- alternative interpretations of the key:
- ASCII decoded from hex
- raw hex string as bytes
- binary decoded from inner hex
→ all variants result in HTTP 401
---
### Additional tests
- tested with multiple users (including admin)
- password is correct (login via app works)
- permissions tested:
- 2 (Web)
- 4 (App)
- UUID exactly as in documentation:
098802e1-02b4-603c-ffffeee000d80cfd
- info = simple string ("Python Test")
---
### Important observation
An encrypted test request to:
/jdev/sys/getkey2/{user}
works perfectly → encryption itself is correct
---
### Question
Has anyone successfully implemented the JWT flow on a 16.x Miniserver and can clarify:
1. What is the exact interpretation of the `key` returned by getkey2 for HMAC?
2. Has anything changed in getjwt behavior in recent Miniserver versions?
3. Are there any restrictions regarding users or permissions for JWT generation?
---
### Current assumption
At this point I suspect either:
- the documentation is not fully clear regarding key interpretation
- or getjwt behavior has changed in newer versions
Any help or working example would be greatly appreciated 👍
Best regards
Patrick
Kommentar