fix: update Winix mobile auth flow for validateMobileInfo changes#130
Open
iboolka wants to merge 1 commit intoiprak:mainfrom
Open
fix: update Winix mobile auth flow for validateMobileInfo changes#130iboolka wants to merge 1 commit intoiprak:mainfrom
iboolka wants to merge 1 commit intoiprak:mainfrom
Conversation
Update Winix mobile API payloads, keep registerUser with the new metadata, and fix reauth token validation.
Owner
|
I agree with your finding about |
iprak
requested changes
Mar 14, 2026
Owner
iprak
left a comment
There was a problem hiding this comment.
A few suggestions to helper with linter warnings and potentially help me down the road.
| timeout=DEFAULT_POST_TIMEOUT, | ||
| ) | ||
|
|
||
| if resp.status_code != HTTPStatus.OK: |
Owner
There was a problem hiding this comment.
Can we do this instead?
if resp.status_code != HTTPStatus.OK:
err_data = resp.json()
raise WinixException(
{
"message": "Error while performing RPC checkAccessToken",
"result_code": err_data.get("resultCode"),
"result_message": err_data.get("resultMessage"),
}
)
| ) | ||
|
|
||
| if resp.status_code != HTTPStatus.OK: | ||
| raise Exception( |
Owner
There was a problem hiding this comment.
And here too
if resp.status_code != HTTPStatus.OK:
err_data = resp.json()
raise WinixException(
{
"message": "Error while performing RPC registerUser",
"result_code": err_data.get("resultCode"),
"result_message": err_data.get("resultMessage"),
}
)
| try: | ||
| account.check_access_token() | ||
| Helpers._check_access_token(reponse.access_token, uuid) | ||
| except Exception as err: # pylint: disable=broad-except |
Owner
There was a problem hiding this comment.
And let WinixException pass
except WinixException:
pass
| account.check_access_token() | ||
| Helpers._register_user(access_token, uuid, username) | ||
| Helpers._check_access_token(access_token, uuid) | ||
| except Exception as err: # pylint: disable=broad-except |
Owner
There was a problem hiding this comment.
And let WinixException pass
except WinixException:
pass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates the Winix cloud auth/device discovery flow to match the current mobile app behavior.
Problem
Starting around March 12-13, 2026, Winix cloud requests began failing for some users with:
400: The user is not valid. - validateMobileInfoFor my account/device, login itself still succeeds, but device discovery fails afterward.
What changed
This PR:
registerUser, but sends it with the updated payload formatcheckAccessTokenaligned with the current mobile app payloadgetDeviceInfoListto use the same mobile metadataWhy
registerUseris still neededI tested the calls manually against the Winix cloud endpoints.
Observed behavior on my account/device:
checkAccessToken(updated metadata)->SUCCESSgetDeviceInfoList(updated metadata)->400 validateMobileInforegisterUser(old payload)->FAILregisterUser(updated metadata + email)->SUCCESSgetDeviceInfoList(updated metadata)->SUCCESSBecause of that, simply removing
registerUserwas not sufficient in my case.Code changes
custom_components/winix/helpers.pyregisterUserwith updated metadata andemailcheckAccessTokenwith updated metadata_register_user(...)_check_access_token(...)get_device_stubs(...)Result
After this patch:
Notes
Tested with: