windkh / node-red-contrib-shelly

Shelly control nodes for node red.
MIT License
34 stars 21 forks source link

GEN2 enabled Authentication fails #79

Closed aschmidt74 closed 2 years ago

aschmidt74 commented 2 years ago

I'm running a few gen2 Shelly Plus 2 pm devices, in shutter-mode or switch-mode respecticely. In node-red the gen2-nodes work fine in callback-mode, all scripts get pushed nicely and callback correctly.

However as soon as I enable Authenticaion in a device, update the node with credentials ("admin"/<password> alternatively <empty>/<password>) and redeploy, I get this as the gen2-nodes output: Uploading script failed Error: Request failed with status code 401

Upload Retry Interval=0 even led to node-red restart loop.

windkh commented 2 years ago

Thanks for reporting this... I will check this

windkh commented 2 years ago

It seems that the gen 2 devices only have a password and basic auth is replaced with digest auth.

aschmidt74 commented 2 years ago

very true. basic-auth doesn't work anymore.❌ only digest-auth is supported.✅

windkh commented 2 years ago

@windkh https://stackoverflow.com/questions/54842977/digest-auth-using-axios https://axios-digest-auth.mhoc.co/ https://github.com/rearn/axios-digest https://github.com/axios/axios/issues/686

windkh commented 2 years ago

Digest auth should work now, but not 100%. I found out that SetConfig refuses the authorization while all other routes that I tested work flawlessly. Right now only polling mode works fine with authorization enabled. e.g. /rpc/Sys.GetStatus works