py-electrolux-ocp icon indicating copy to clipboard operation
py-electrolux-ocp copied to clipboard

Error with a user during authentication

Open albaintor opened this issue 1 year ago • 6 comments

Hi @Woyken ,

I have received this issue from a user https://github.com/albaintor/homeassistant_electrolux_status/issues/28#issuecomment-1943761943

The error comes gigyaClient. I am not really aware of its goal, it seems to extract info based on the user region ?

File "/config/custom_components/electrolux_status/electroluxwrapper/gigyaClient.py", line 147, in get_ids data: SocializeGetIdsResponse = await response.json(content_type=None)

Thank you for your help

albaintor avatar Feb 14 '24 13:02 albaintor

Hey, it's probably responding with some error status code. Can you try updating the library, I recently updated it to throw on status code error from Gigya. I found out reading their documentation that there is a header you pass in to either always return status 200 or allow "normal error" status codes too.

I noticed you are using copied older version that always expects success. If you update we might get some more details on what is happening

Woyken avatar Feb 14 '24 14:02 Woyken

Although it looks like it can't parse Json, either response body is not valid Json or is empty, so I'm not sure if it'll help. I'll try some different requests, what the response could be in few hours on my side

Woyken avatar Feb 14 '24 14:02 Woyken

Hi, The response is empty in this case from the logs : "File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None"

albaintor avatar Feb 14 '24 14:02 albaintor

Looks like I had GET and POST requests mixed up for get_ids() gigya request, not sure why it even worked sometimes. Fixed that. Also added a bunch more error logging. If request fails to parse JSON. will output what ever it received as text(), and a bunch more stuff, should be easier to spot the problem.

Released version: 0.0.12

Woyken avatar Feb 14 '24 17:02 Woyken

Ok thank you. You also changed the user agent to make the request always pass ? I will then switch back to an external dependency instead of wrapping it

albaintor avatar Feb 14 '24 21:02 albaintor

Yes, I added user agent header: "pyelectroluxocp/VERSION"

Woyken avatar Feb 15 '24 05:02 Woyken