alladdin / node-lox-ws-api

Node JS WebSocket Loxone™ API
MIT License
32 stars 23 forks source link

Token encoding doesn't work with Loxone 9.0.9.26 #16

Open bimcio opened 6 years ago

bimcio commented 6 years ago

Hi, my Loxone is currently running firmware 9.0.9.26 and I am connecting using 'AES-256-CBC'. This works fine. But as this mode is no longer supported in the latest version, before upgrading I wanted to make sure the 'Token-Enc' works. Unfortunatelly I was not able to make it work. I always get 401 when trying to call jdev/sys/gettoken:

test_loxapi.js:20
2018-04-08T19:34:37.992Z DEBUG: Loxone text message: {"LL":{"control":"jdev/sys/gettoken/849284a2e6455148d253c8e2f4ff85bf4fc43202/admin/2/edfc5f9a-df3f-4cad-9dddcdc42c732be2/nodeloxWSAPI","value":{"lastE...(210)
test_loxapi.js:20
2018-04-08T19:34:37.993Z INFO : Loxone auth error: {"type":"control","data":{"LL":{"control":"jdev/sys/gettoken/849284a2e6455148d253c8e2f4ff85bf4fc43202/admin/2/edfc5f9a-df3f-4cad-9dddcdc42c732be2/nodeloxWSAPI","value":{"lastEdit":"2009-01-01 01:00:00","unix":1230768000},"code":"401"}},"control":"jdev/sys/gettoken/849284a2e6455148d253c8e2f4ff85bf4fc43202/admin/2/edfc5f9a-df3f-4cad-9dddcdc42c732be2/nodeloxWSAPI","value":{"lastEdit":"2009-01-01 01:00:00","unix":1230768000}}

Bartek

alladdin commented 6 years ago

I have the same version of the firmware on my miniserver and 'Token-Enc' works. Make sure that you have correct credentials and latest version of node-lox-ws-api.

bartekmotyl commented 6 years ago

I have used the test program from node-lox-ws-api-testing with following line: var lox = new LoxoneAPI("192.168.1.100", "admin", "password", true, 'AES-256-CBC'); This works. After changing the last parameter to 'Hash' it still works. When changed to 'Token-Enc' (leaving the other parameters unchanged) it doesn't work anymore.

Can you maybe suggest what else I can check? (I am running the test on Windows 10)

bimcio commented 6 years ago

Btw. The same happens when trying to connect to demominiserver.loxone.com:7779 (u:web pass:web). Login from browser works fine, does not work from node-lox-ws-api-testing. This demo server is running 9.3.3.26 (so no other way to login but TokenEnc).

bimcio commented 6 years ago

Hmm, I just realized I made a mess, sorry. 'bartekmotyl' is my second github account (corporate), I haven't noticed I was logged in with another account. Anyway, all the comments above are from me.

idoodler commented 6 years ago

Loxone just published its own node.js module that handles authentication, encryption and tokens in an easy way.

Its version 0.9 but it will work, I am using it in one of my own projects for a while now. (Yes, I am an Loxone employee...)

You may wanna check it out: LxCommunicator