schmittx / home-assistant-eero

Eero integration for Home Assistant
MIT License
118 stars 23 forks source link

Add support for Amazon account login method #17

Open Buckeyes02 opened 3 years ago

Buckeyes02 commented 3 years ago

Trying to setup in integrations it gives an unknown error when typing in an email address and hitting submit. The logs from this are below. Putting in a phone number doesn't throw an error, but it never sends a text. Using latest integration version (1.1.3) and Home Assistant (2021.7.3). Home Assistant is installed via the supervised method running on Debian if that makes a difference, however, I tested it on a different install running HassOS with the same errors.

Thanks.

Logs:

**Log1** This error originated from a custom integration.

Logger: custom_components.eero.config_flow Source: custom_components/eero/config_flow.py:69 Integration: eero (documentation, issues) First occurred: 5:04:14 PM (1 occurrences) Last logged: 5:04:14 PM

Status: 401, Error Message: error.login.unknown *End Log1***

****Log2***** This error originated from a custom integration.

Logger: aiohttp.server Source: custom_components/eero/config_flow.py:72 Integration: eero (documentation, issues) First occurred: 5:04:14 PM (1 occurrences) Last logged: 5:04:14 PM

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 197, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 155, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 63, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 202, in async_configure result = await self._async_handle_step(flow, cur_step["step_id"], user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/eero/config_flow.py", line 72, in async_step_user self.user_input[CONF_USER_TOKEN] = self.response["user_token"] TypeError: 'NoneType' object is not subscriptable

*****End Log2****

jtitley commented 3 years ago

Same issue here. I posted on the HA community forums as well. But now that I think about it, it never worked in the App either. I ended up using an Amazon account because no verification by email or SMS. I think it's a problem with Eero.

Buckeyes02 commented 3 years ago

Same issue here. I posted on the HA community forums as well. But now that I think about it, it never worked in the App either. I ended up using an Amazon account because no verification by email or SMS. I think it's a problem with Eero.

Can you explain what you mean that you ended up using an Amazon account? Is there another way to get this integration working?

Thanks.

trekie86 commented 2 years ago

This error originated from a custom integration.

Logger: custom_components.eero.config_flow Source: custom_components/eero/config_flow.py:69 Integration: eero (documentation, issues) First occurred: 2:50:23 PM (1 occurrences) Last logged: 2:50:23 PM

Status: 401, Error Message: error.login.unknown

This error originated from a custom integration.

Logger: aiohttp.server Source: custom_components/eero/config_flow.py:72 Integration: eero (documentation, issues) First occurred: 2:50:23 PM (1 occurrences) Last logged: 2:50:23 PM

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 211, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 155, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 63, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 202, in async_configure result = await self._async_handle_step(flow, cur_step["step_id"], user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/eero/config_flow.py", line 72, in async_step_user self.user_input[CONF_USER_TOKEN] = self.response["user_token"] TypeError: 'NoneType' object is not subscriptable

I'm facing the same problem.

trekie86 commented 2 years ago

So I did some additional digging to ensure I could see what was going on. When I make the request to the API (POST https://api-user.e2ro.com/2.2/login) with my email address, the response is

{
    "meta": {
        "code": 401,
        "server_time": "2021-08-30T23:48:32.057Z",
        "error": "error.login.unknown"
    }
}

When I test with my phone number, I get the following response:

{
    "meta": {
        "code": 200,
        "server_time": "2021-08-30T23:49:39.117Z"
    },
    "data": {
        "user_token": "<MY_SECRET_TOKEN>"
    }
}

However, in the later situation I do not receive any text message.

Looking at my Eero app, I have my Amazon login setup as my profile. So I suspect there is a step as part of the authentication that is missing to SSO experience for an Amazon profile. I can't seem to find documentation for the Eero API to figure out what properties are necessary to support the Amazon auth.

broyuken commented 2 years ago

I'm having this same issue. Can you not use this integration if you are using your amazon account as the login?

Buckeyes02 commented 2 years ago

I'm having this same issue. Can you not use this integration if you are using your amazon account as the login?

That's what I'm assuming. I ended up removing the eero network from the Amazon account and created a new non-Amazon login. After recreating the network on the new account this integration worked fine. Luckily, this was for my parents network that is pretty basic, so it was easy enough to recreate it. I'm going to go ahead and close this issue since I'm not sure that it can be resolved anyway and there is a workaround.

trekie86 commented 2 years ago

Just because there is a workaround doesn't mean that it isn't a bug that should be investigated. Personally I think this should be left open to find a solution, not everyone can just as easily teardown their network and set it back up again.

joeShuff commented 2 years ago

I agree this should be left open, but it might also be useful to go to the library that this integration uses for the authentication. This is an issue on that repo for this exact thing. Maybe send some traffic that way?

broyuken commented 2 years ago

I agree as well, please open this back up so we can work on getting it to work. I know amazon logins work because the alexa media player uses amazon for authentication.

Buckeyes02 commented 2 years ago

I'll go ahead and reopen this for you guys. Not sure how much good it will do given that it has been open for a while with zero traction toward a solution. Just semantics, but knowing what the problem is now I wouldn't classify it as a bug, but more of a feature request to support a new authentication method. Regardless, I'm going to stop following this issue as I no longer have a stake in it.

jmg292 commented 2 years ago

@joeShuff thanks for linking to the eero-client library issue. I had no idea this integration existed, but I've been reversing the eero APK for a few hours to solve this Amazon auth issue, with the express intent of getting that data integrated into hass. You just saved me a ton of effort. Now I can just focus on fixing the issue here instead.

@trekie86's earlier suspicions about missing some steps is right on the money. The auth flow for an Amazon account is separate from eero's account management - it's a convoluted multi-step challenge-handshake-response protocol handled through an Amazon library embedded within the eero APK. Fortunately for us it's documented and there's an SDK available.

Should be all we need to get started on an implementation for this integration. I'm getting started on it now.

Should have an update in a few days unless I get sidetracked or someone else beats me to it!

joeShuff commented 2 years ago

@jmg292 Glad to help! Good luck trying to figure this out, if you need any help testing/a fresh set of eyes on the code give me a shout, I am quite experienced in python and would like to help!

schmittx commented 2 years ago

I personally don't plan to pursue adding support for Amazon login, namely because I don't use it so I can't test it easily. However, feel free to submit a PR if you'd like.

smiller171 commented 2 years ago

@jmg292 Did you ever make any progress on this?

jvolkheimer commented 2 years ago

Hi all - at some point, Amazon added the ability to create more than one administrative account. On a separate device I created a non-Amazon account, invited that account from my Amazon Eero account, and used that for this integration. Works like a charm...so not a fix but a decent workaround IMO.

joeShuff commented 2 years ago

That worked for me, thanks! @jvolkheimer

daveparslow commented 1 year ago

@jvolkheimer This also worked for me. Wish this was documented on the main readme.

brian-gates commented 1 year ago

@jvolkheimer I just created a new, non-Amazon account and still get Unknown error occurred when attempting to login with the integration. Is this function no longer working or is there some step I'm missing?

addshore commented 6 months ago

Further to the workaround by @jvolkheimer,

I just generated an invite link for another admin account, logged out from my Amazon account in the eero app on my phone, and joined eero again creating a new account using the link on the same device, using my regular email and password.

robd003 commented 2 days ago

@schmittx Would you be open to debugging with a user who has an Amazon account for Eero logins?