Skip to content

Mi Home cloud: reuse stored passToken via login cookies - #1684

Open
jeeves-butler-co wants to merge 1 commit into
Tasshack:devfrom
jeeves-butler-co:fix/xiaomi-cloud-passtoken-cookie-clean
Open

Mi Home cloud: reuse stored passToken via login cookies#1684
jeeves-butler-co wants to merge 1 commit into
Tasshack:devfrom
jeeves-butler-co:fix/xiaomi-cloud-passtoken-cookie-clean

Conversation

@jeeves-butler-co

Copy link
Copy Markdown

This is a smaller version of #1683 that keeps the part Tasshack identified as valid and removes the unsupported refresh-token flow and timeout/retry changes.

Changes:

  • Store passToken as an optional 5th field in auth_key.
  • Inject stored passToken/userId into the Mi Home login session cookies before serviceLogin.
  • If serviceLogin returns an STS location from the stored cookie, skip password/2FA and proceed directly to login_step_3().
  • Preserve existing timeout/retry/check_login behavior.

Validation:

  • python3 -m py_compile custom_components/dreame_vacuum/dreame/protocol.py

Context: derived from the discussion in #1683.

@Tasshack

Copy link
Copy Markdown
Owner

@jeeves-butler-co have you tested this?

@jeeves-butler-co

Copy link
Copy Markdown
Author

Not end-to-end against a real Mi Home account/service-token-expiration case.

What I tested:

  • syntax/import-level validation with python3 -m py_compile custom_components/dreame_vacuum/dreame/protocol.py;
  • diff review to make sure this PR only stores/reuses passToken through cookies and does not change timeout/retry/check_login behavior.

So this should be treated as an unverified implementation of the cookie flow you described, not as a confirmed fix. If you prefer not to keep untested PRs open, I can close it.

@Tasshack

Copy link
Copy Markdown
Owner

As I said before, it is very hard for me to test this on a solid fiber connection on a half static ip but I will give it a try anyway...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants