Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to auth via cloud #6

Open
troykelly opened this issue Jul 11, 2021 · 6 comments
Open

Unable to auth via cloud #6

troykelly opened this issue Jul 11, 2021 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@troykelly
Copy link

Receiving the error below (with a correct email address)

Screen Shot 2021-07-11 at 10 03 23 pm

Logger: aiohttp.server
Source: custom_components/dyson_cloud/config_flow.py:71
Integration: dyson_cloud (documentation, issues)
First occurred: 10:00:31 PM (3 occurrences)
Last logged: 10:00:54 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/dyson_cloud/config_flow.py", line 71, in async_step_email
    self._verify = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/libdyson/cloud/account.py", line 127, in login_email_otp
    response = self.request(
  File "/usr/local/lib/python3.9/site-packages/libdyson/cloud/account.py", line 119, in request
    raise DysonInvalidAuth
libdyson.exceptions.DysonInvalidAuth
@shenxn
Copy link
Owner

shenxn commented Jul 25, 2021

Yes this has something to do with changes in Dyson API. I'm a little busy recently. It'll be good if someone can somehow find out how the new login process works.

@shenxn shenxn added the help wanted Extra attention is needed label Jul 25, 2021
@kintaroju
Copy link

gotta hate it when dyson changes the login process again, this is like the 2nd time they did this within this year.

@blairscarlett
Copy link

I just installed this addon and am having the same authentication issue with the Cloud

@grahambish
Copy link

Getting the same error trying to set up Dyson Cloud too 😞
They keep changing that login api a lot.

@micahqcade
Copy link

I think I found a fix, the Dyson login changed, and requires a "2FAish" setup where they send you a code and then you use your password and code to sign. Log out of the mobile app, close the app, then log back in using the code provided. I did that and my integration was able to login automatically without me manually logging on . I found this answer in a different dyson repository. I guess their 2FA is a one time thing

@dotvezz
Copy link

dotvezz commented Apr 1, 2023

For anyone still dealing with this Dyson login issue, I've got a fix implemented over in a PR over here: libdyson-wg/libdyson-neon#6. If anyone wants to help test it, you can clone https://github.com/dotvezz/libdyson-neon/tree/task/fix-account-login and run the get_devices.py script!

Short version I did some reverse-engineering of the Android mobile app. I discovered a mysterious GET request it was making to a provisioning API. Turns out, just by making that request (and even throwing away its response - no session tokens or cookies to hold onto), it unlocks something on the server side, and allows the rest of the ogin requests from your IP address. I've included more thoughts about this in the code comments and PR description for anyone who is curious.

If it proves robust enough in testing, I'll get it merged and tag a new release of https://github.com/libdyson-wg/ha-dyson-cloud to use the updated new login flow. To use it, you'll need to migrate to the new repositories in your HACS setup, there's a simple how-to in the readme here: https://github.com/libdyson-wg/ha-dyson#migration-from-shenxnha-dyson. Users have reported painless migrations so far!

Quick edit: For anyone curious about the "libdyson-wg" organization those new repositories are on, feel free to check out #20 for more information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants