Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Login fails when 2FA is enabled (and how to fix it) #57

Open
genebean opened this issue Jan 13, 2021 · 1 comment
Open

Login fails when 2FA is enabled (and how to fix it) #57

genebean opened this issue Jan 13, 2021 · 1 comment

Comments

@genebean
Copy link

genebean commented Jan 13, 2021

Describe the bug
If a user has 2FA enabled on their Eufy account, the login process fails due to not finishing the authentication flow

To Reproduce
Steps to reproduce the behavior:

  1. enable 2FA
  2. post email and password to https://mysecurity.eufylife.com/api/v1/passport/login
  3. observed that the response contains "msg": "need validate code",

Expected behavior
I expect the login process to detect the need for a validation code and to execute the additional steps needed (detailed below)

Additional context

By inspecting the traffic sent by my browser, I was able to work out that the flow can be completed as follows in Postman:

  1. post to https://mysecurity.eufylife.com/api/v1/passport/login with the body
    {
        "email": "[email protected]",
        "password": "Some-g00d-password"
    }
  2. observe that the response contains both "msg": "need validate code" and "data": { "auth_token": "12baeasd..." } like so:
    {
        "code": 26052,
        "msg": "need validate code",
        "data": {
            "user_id": "abc12343w534535rer",
            "email": "[email protected]",
            "nick_name": "user",
            "auth_token": "12baeasdfasdfawerawefasdfasdfasdf",
            "...": "..."
        }
    }
  3. post to https://mysecurity.eufylife.com/api/v1/sms/send/verify_code with the header X-Auth-Token: <the auth token value from the response above> with the body
    {
        "message_type":2
    }
  4. get verification code from my email
  5. post to https://mysecurity.eufylife.com/api/v1/passport/login with the header X-Auth-Token: <the auth token value from the response above> with the body
    {
        "email": "[email protected]",
        "password": "Some-g00d-password",
        "verify_code": "< code from my email >"
    }
  6. observe that the response contains "msg": "ok"

I am not sure how to work this flow into this repo's code but doing so would make it work with 2FA enabled accounts.

@evilmarty
Copy link
Collaborator

This is something I intend to work on. My main priority for the moment is expanding device support and adding P2P functionality to better control said devices. How I've bypassed the need for MFA is create a seperate account for my integration which doesn't have MFA enabled.

I'm leaving this issue open as it is still valid.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants