Skip to content
This repository was archived by the owner on Mar 25, 2024. It is now read-only.
This repository was 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

@genebean

Description

@genebean

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": "user@example.com",
        "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": "user@example.com",
            "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": "user@example.com",
        "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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions