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

Fixes Panasonic auth breaking changes #45

Merged
merged 6 commits into from
Mar 29, 2024
Merged

Conversation

cjaliaga
Copy link
Owner

@cjaliaga cjaliaga commented Mar 29, 2024

This pull request primarily focuses on enhancing the authentication process due to the Panasonic changes (18th of March 2024) in the aioaquarea package. The changes include the addition of a new constant for client ID, importing new modules, and significant modifications to the core.py file to handle the enhanced authentication process. The changes also include the introduction of a new optional access token and modifications to the request method to handle external URLs.

Thanks to @bimusiek for sharing his Typescript implementation in https://github.com/Hernas/homebridge-panasonic-heat-pump

Enhancements to authentication:

Imports and Initializations:

Modifications to existing methods:

  • aioaquarea/core.py: Modified the is_logged method to check for _access_token instead of _token_expiration.
  • aioaquarea/core.py: Modified the request method to handle optional parameters url and external_url, and added logic to check for access token and expiration time in the response. [1] [2]
  • aioaquarea/core.py: Modified the look_for_errors method to accept a dictionary instead of a response object.

Major changes to the authentication process:

  • aioaquarea/core.py: Extensively modified the _login_production method to handle the enhanced authentication process, which includes multiple requests to different URLs, parsing responses, and handling various scenarios.
    This pull request primarily focuses on improving the authentication process and updating the request handling in the aioaquarea package. The changes include the addition of a new constant for client ID, the introduction of an access token for user authentication, and modifications to the request method to handle external URLs and access tokens. Additionally, the login process has been significantly revamped to handle a more complex authentication flow.

Here are the most important changes:

New Constants and Imports:

  • aioaquarea/const.py: Added AQUAREA_SERVICE_AUTH_CLIENT_ID constant for client authentication.
  • aioaquarea/core.py: Imported re and html modules for regular expression and HTML utilities.

Authentication Enhancements:

  • aioaquarea/core.py: Introduced _access_token as an optional string in the __init__ method for user authentication.
  • aioaquarea/core.py: Modified the is_logged method to use _access_token instead of _token_expiration to determine if the user is logged in.

Request Handling Updates:

  • aioaquarea/core.py: Updated the request method to accept optional parameters url and external_url to handle requests to external URLs. The method now also checks for an access token in the response and updates _access_token and _token_expiration accordingly. [1] [2]
  • aioaquarea/core.py: Modified the look_for_errors method to accept a dictionary data instead of response to handle error checking.

Login Process Revamp:

  • aioaquarea/core.py: The _login_production method has been extensively updated to handle a more complex authentication flow. This includes multiple requests to authenticate the user, extract necessary information from responses, and handle errors related to invalid user credentials.

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