Phype / purei9_unofficial

This project includes a client/library to connect to Electrolux and AEG cleaner robots.
https://pypi.org/project/purei9-unofficial
MIT License
29 stars 5 forks source link

Login 403 Error not a valid key=value pair (missing equal-sign) in Authorization header: #28

Closed techillin closed 1 month ago

techillin commented 3 months ago
~ # python3 -m purei9_unofficial -d -o json cloud -v3 -c "XXXXXX:XXXXXXX" status
2024-08-03 12:27:06,778 - purei9_unofficial.util - DEBUG - HTTP POST https://api.ocp.electrolux.one/one-account-authorization/api/v1/token
2024-08-03 12:27:06,783 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.ocp.electrolux.one:443
2024-08-03 12:27:06,933 - urllib3.connectionpool - DEBUG - https://api.ocp.electrolux.one:443 "POST /one-account-authorization/api/v1/token HTTP/11" 200 809
2024-08-03 12:27:06,938 - purei9_unofficial.util - DEBUG - HTTP 200 <Response [200]> (sensitive data not shown)
2024-08-03 12:27:06,940 - purei9_unofficial.util - DEBUG - HTTP POST https://api.ocp.electrolux.one/one-account-authentication/api/v1/authenticate
2024-08-03 12:27:06,950 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.ocp.electrolux.one:443
2024-08-03 12:27:07,071 - urllib3.connectionpool - DEBUG - https://api.ocp.electrolux.one:443 "POST /one-account-authentication/api/v1/authenticate HTTP/11" 403 1582
2024-08-03 12:27:07,073 - purei9_unofficial.util - DEBUG - HTTP 403 <Response [403]> {"message":"'eyJraWQiOiIxMGZhMWQwOWY4YjM2OGFjYmE4YmRiNDYxOTFmZmVhODE1MmZiM2YzZjQ5N2RhZjk1OWFjNWIzNDM5ZDI3OGY0IiwiYWxnIjoiUlMyNTYiLCJ0eXAiOiJKV1QifQ.eyJpYXQiOjE3MjI2ODA4MjYsImlzcyI6Imh0dHBzOi8vYXBpLm9jcC5lbGVjdHJvbHV4Lm9uZS9vbmUtYWNjb3VudC1hdXRob3JpemF0aW9uIiwiYXVkIjoiaHR0cHM6Ly9hcGkub2NwLmVsZWN0cm9sdXgub25lIiwiZ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m0QIJmpd-DYV29ZOqNKZIl-f_Ee3QdE9gDuVto1uyPATePAHtZ1WXMuQIe2zvF6RXgvbhEMjlImHzzMT69KVXEG73gfYePHojct7piTJzBfJFNeDWbzEAqovsBWiybcBKsEcToOD_8FnkuqG-ZP1vEBOplg'."}
2024-08-03 12:27:07,073 - purei9_unofficial.util - DEBUG - HTTP POST https://api.ocp.electrolux.one/one-account-authentication/api/v1/authenticate
2024-08-03 12:27:07,077 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.ocp.electrolux.one:443
2024-08-03 12:27:07,193 - urllib3.connectionpool - DEBUG - https://api.ocp.electrolux.one:443 "POST /one-account-authentication/api/v1/authenticate HTTP/11" 403 1582
2024-08-03 12:27:07,194 - purei9_unofficial.util - DEBUG - HTTP 403 <Response [403]> {"message":"'eyJraWQiOiIxMGZhMWQwOWY4YjM2OGFjYmE4YmRiNDYxOTFmZmVhODE1MmZiM2YzZjQ5N2RhZjk1OWFjNWIzNDM5ZDI3OGY0IiwiYWxnIjoiUlMyNTYiLCJ0eXAiOiJKV1QifQ.eyJpYXQiOjE3MjI2ODA4MjYsImlzcyI6Imh0dHBzOi8vYXBpLm9jcC5lbGVjdHJvbHV4Lm9uZS9vbmUtYWNjb3VudC1hdXRob3JpemF0aW9uIiwiYXVkIjoiaHR0cHM6Ly9hcGkub2NwLmVsZWN0cm9sdXgub25lIiwiZXhwIjoxNzIyNzI0MDI2LCJzdWIiOiJFbHhPbmVBcHAiLCJhenAiOiJFbHhPbmVBcHAiLCJzY29wZSI6IiIsIm9jYyI6bnVsbH0.Ch6hp-POAv4uNO0shn6zJDy1a2oWJ3sEsnW2z-Pc8h81JeInFwm7mGSvzzaUS9-4VNqM6UAFIqIhBWUt5McJ58SY4teJhKIAnRvPmI9RnDABLDdQVl7g-MpnzxGcftUqjrmyVklETgZNQ0E5M61Na9Y3pj83thhdHggY2rYG13MXH2i5jjKcK3Zzz5Jm0QIJmpd-DYV29ZOqNKZIl-f_Ee3QdE9gDuVto1uyPATePAHtZ1WXMuQIe2zvF6RXgvbhEMjlImHzzMT69KVXEG73gfYePHojct7piTJzBfJFNeDWbzEAqovsBWiybcBKsEcToOD_8FnkuqG-ZP1vEBOplg' not a valid key=value pair (missing equal-sign) in Authorization header: 'Bearer eyJraWQiOiIxMGZhMWQwOWY4YjM2OGFjYmE4YmRiNDYxOTFmZmVhODE1MmZiM2YzZjQ5N2RhZjk1OWFjNWIzNDM5ZDI3OGY0IiwiYWxnIjoiUlMyNTYiLCJ0eXAiOiJKV1QifQ.eyJpYXQiOjE3MjI2ODA4MjYsImlzcyI6Imh0dHBzOi8vYXBpLm9jcC5lbGVjdHJvbHV4Lm9uZS9vbmUtYWNjb3VudC1hdXRob3JpemF0aW9uIiwiYXVkIjoiaHR0cHM6Ly9hcGkub2NwLmVsZWN0cm9sdXgub25lIiwiZXhwIjoxNzIyNzI0MDI2LCJzdWIiOiJFbHhPbmVBcHAiLCJhenAiOiJFbHhPbmVBcHAiLCJzY29wZSI6IiIsIm9jYyI6bnVsbH0.Ch6hp-POAv4uNO0shn6zJDy1a2oWJ3sEsnW2z-Pc8h81JeInFwm7mGSvzzaUS9-4VNqM6UAFIqIhBWUt5McJ58SY4teJhKIAnRvPmI9RnDABLDdQVl7g-MpnzxGcftUqjrmyVklETgZNQ0E5M61Na9Y3pj83thhdHggY2rYG13MXH2i5jjKcK3Zzz5Jm0QIJmpd-DYV29ZOqNKZIl-f_Ee3QdE9gDuVto1uyPATePAHtZ1WXMuQIe2zvF6RXgvbhEMjlImHzzMT69KVXEG73gfYePHojct7piTJzBfJFNeDWbzEAqovsBWiybcBKsEcToOD_8FnkuqG-ZP1vEBOplg'."}
2024-08-03 12:27:07,194 - purei9_unofficial.util - DEBUG - HTTP POST https://api.ocp.electrolux.one/one-account-authentication/api/v1/authenticate
2024-08-03 12:27:07,198 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.ocp.electrolux.one:443
2024-08-03 12:27:07,319 - urllib3.connectionpool - DEBUG - https://api.ocp.electrolux.one:443 "POST /one-account-authentication/api/v1/authenticate HTTP/11" 403 1582
2024-08-03 12:27:07,321 - purei9_unofficial.util - DEBUG - HTTP 403 <Response [403]> {"message":"'eyJraWQiOiIxMGZhMWQwOWY4YjM2OGFjYmE4YmRiNDYxOTFmZmVhODE1MmZiM2YzZjQ5N2RhZjk1OWFjNWIzNDM5ZDI3OGY0IiwiYWxnIjoiUlMyNTYiLCJ0eXAiOiJKV1QifQ.eyJpYXQiOjE3MjI2ODA4MjYsImlzcyI6Imh0dHBzOi8vYXBpLm9jcC5lbGVjdHJvbHV4Lm9uZS9vbmUtYWNjb3VudC1hdXRob3JpemF0aW9uIiwiYXVkIjoiaHR0cHM6Ly9hcGkub2NwLmVsZWN0cm9sdXgub25lIiwiZXhwIjoxNzIyNzI0MDI2LCJzdWIiOiJFbHhPbmVBcHAiLCJhenAiOiJFbHhPbmVBcHAiLCJzY29wZSI6IiIsIm9jYyI6bnVsbH0.Ch6hp-POAv4uNO0shn6zJDy1a2oWJ3sEsnW2z-Pc8h81JeInFwm7mGSvzzaUS9-4VNqM6UAFIqIhBWUt5McJ58SY4teJhKIAnRvPmI9RnDABLDdQVl7g-MpnzxGcftUqjrmyVklETgZNQ0E5M61Na9Y3pj83thhdHggY2rYG13MXH2i5jjKcK3Zzz5Jm0QIJmpd-DYV29ZOqNKZIl-f_Ee3QdE9gDuVto1uyPATePAHtZ1WXMuQIe2zvF6RXgvbhEMjlImHzzMT69KVXEG73gfYePHojct7piTJzBfJFNeDWbzEAqovsBWiybcBKsEcToOD_8FnkuqG-ZP1vEBOplg' not a valid key=value pair (missing equal-sign) in Authorization header: 'Bearer eyJraWQiOiIxMGZhMWQwOWY4YjM2OGFjYmE4YmRiNDYxOTFmZmVhODE1MmZiM2YzZjQ5N2RhZjk1OWFjNWIzNDM5ZDI3OGY0IiwiYWxnIjoiUlMyNTYiLCJ0eXAiOiJKV1QifQ.eyJpYXQiOjE3MjI2ODA4MjYsImlzcyI6Imh0dHBzOi8vYXBpLm9jcC5lbGVjdHJvbHV4Lm9uZS9vbmUtYWNjb3VudC1hdXRob3JpemF0aW9uIiwiYXVkIjoiaHR0cHM6Ly9hcGkub2NwLmVsZWN0cm9sdXgub25lIiwiZXhwIjoxNzIyNzI0MDI2LCJzdWIiOiJFbHhPbmVBcHAiLCJhenAiOiJFbHhPbmVBcHAiLCJzY29wZSI6IiIsIm9jYyI6bnVsbH0.Ch6hp-POAv4uNO0shn6zJDy1a2oWJ3sEsnW2z-Pc8h81JeInFwm7mGSvzzaUS9-4VNqM6UAFIqIhBWUt5McJ58SY4teJhKIAnRvPmI9RnDABLDdQVl7g-MpnzxGcftUqjrmyVklETgZNQ0E5M61Na9Y3pj83thhdHggY2rYG13MXH2i5jjKcK3Zzz5Jm0QIJmpd-DYV29ZOqNKZIl-f_Ee3QdE9gDuVto1uyPATePAHtZ1WXMuQIe2zvF6RXgvbhEMjlImHzzMT69KVXEG73gfYePHojct7piTJzBfJFNeDWbzEAqovsBWiybcBKsEcToOD_8FnkuqG-ZP1vEBOplg'."}
2024-08-03 12:27:07,321 - purei9_unofficial.util - ERROR - Giving up due to no left retries. Wrong credentials?
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/purei9_unofficial/util.py", line 22, in do_http
    r.raise_for_status()
  File "/usr/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.ocp.electrolux.one/one-account-authentication/api/v1/authenticate

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/purei9_unofficial/util.py", line 22, in do_http
    r.raise_for_status()
  File "/usr/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.ocp.electrolux.one/one-account-authentication/api/v1/authenticate

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/lib/python3.12/site-packages/purei9_unofficial/__main__.py", line 164, in <module>
    robots = client.getRobots()
             ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/purei9_unofficial/cloudv3.py", line 251, in getRobots
    r = do_http("GET", self.apiurl + "/appliances", headers=self._getHeaders())
                                                            ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/purei9_unofficial/cloudv3.py", line 227, in _getHeaders
    r = do_http("POST", self.authenticationurl + "/authenticate", json={"username":self.username, "password": self.password}, headers={"Authorization": "Bearer " + self.token["accessToken"],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/purei9_unofficial/util.py", line 26, in do_http
    return do_http(method, url, retries-1, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/purei9_unofficial/util.py", line 26, in do_http
    return do_http(method, url, retries-1, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/purei9_unofficial/util.py", line 29, in do_http
    raise r
  File "/usr/lib/python3.12/site-packages/purei9_unofficial/util.py", line 22, in do_http
    r.raise_for_status()
  File "/usr/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.ocp.electrolux.one/one-account-authentication/api/v1/authenticate
~ #
Phype commented 3 months ago

Yes, i have the same problem, but I'll not be able to fix it for the next 2 weeks. Another home assistant integration has experienced the same and there is now an official Electrolux API available. See:

JohNan commented 3 months ago

Thanks for referencing to my library @Phype I have just pushed a rough first version of it. https://pypi.org/project/pyelectroluxgroup/0.1.0/

Try it out and open an issues or a pull request at the repository if any changes is needed.

Phype commented 1 month ago

I've fixed the Login in version 0.0.15 by implementing their new authenticaion which is based on SAP gigya.