birkir / homebridge-plugin-eufy-security

Eufy security homebridge plugin
Apache License 2.0
84 stars 18 forks source link

Support for 2FA #28

Open Cilusse opened 3 years ago

Cilusse commented 3 years ago

The plugin can't get an auth token right now, presumably because 2FA is enabled on my Eufy Security account.

[1/4/2021, 4:24:05 PM] [EufySecurityHomebridgePlugin] failed to register push token Error: Request failed: https://security-app-eu.eufylife.com/v1/passport/login -> 26052 - need validate code
    at /homebridge/node_modules/homebridge-plugin-eufy-security/node_modules/eufy-node-client/build/http/http.utils.js:24:15
    at Generator.next (<anonymous>)
    at fulfilled (/homebridge/node_modules/homebridge-plugin-eufy-security/node_modules/eufy-node-client/build/http/http.utils.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
[1/4/2021, 4:24:06 PM] [EufySecurityHomebridgePlugin] failed to confirm push token
(node:3868) UnhandledPromiseRejectionWarning: Error: Request failed: https://security-app-eu.eufylife.com/v1/passport/login -> 26052 - need validate code
    at /homebridge/node_modules/homebridge-plugin-eufy-security/node_modules/eufy-node-client/build/http/http.utils.js:24:15
    at Generator.next (<anonymous>)
    at fulfilled (/homebridge/node_modules/homebridge-plugin-eufy-security/node_modules/eufy-node-client/build/http/http.utils.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3868) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3868) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[1/4/2021, 4:24:24 PM] [EufySecurityHomebridgePlugin] registering a push token timed out

It would be nice to support it sometime in the future. Thanks for developing and maintaining this plugin!

Best,

Sixela096 commented 3 years ago

Interested in

qthatswho commented 3 years ago

It's worth noting that, if you have 2fa support enabled, and happen to try to use this plugin with just the login credentials, you may end up getting your Eufy account locked (for at least 24 hours), and possibly (as in my case) require a support request to reset it.

I'd suggest that at least some protection be added so as not to spam login requests when you get back a response that suggests the account has 2fa enabled.