NickWaterton / Unifi-websocket-interface

A Websocket client for Unifi Controller and an example RPi based display
98 stars 10 forks source link

Add support for 2FA #1

Closed muxa closed 4 years ago

muxa commented 4 years ago

I'm using UDM and my account has 2FA enabled. When trying to connect to UDM I'm getting the following error:

PS ...\Code\Unifi-websocket-interface> python unifi_client.py -D -po 443  192.168.1.1 <email> <password>
Debug mode
Unifi OS controller detected
Python: sys.version_info(major=3, minor=8, micro=2, releaselevel='final', serial=0)
Python: sys.version_info(major=3, minor=8, micro=2, releaselevel='final', serial=0)
Python 3 websocket
login() https://192.168.1.1/proxy/network/ as <email>
failed to connect: 
Exited

It keeps trying to connect in a loop.

Without 2FA it connects and pulls events fine.

It would be great to be able to auth with additional 2FA token passed via command line so that this tool works with increased security setups.

UDM Info:

muxa commented 4 years ago

Ignore that. Having a manual 2FA in this tool will make it difficult to automatic things. What I did instead is created a local user under /users/users with Read Only access and use its username/password with the tool. Worked like a charm!

NickWaterton commented 4 years ago

No problem, that's probably a much better idea anyway.