Open ubertao opened 1 month ago
So logging in again fixes the issue? I think this can be avoided by refreshing the mobileme login, which can be done without redoing the account login flow. That means the library should handle it instead of the end user.
Yes, logging in again will fix the issue.
But for my use case, instead of leaving it to library, I'd rather like to get an exception or error code then handle the re-login myself. That's because I have 2 separate scripts:
update.py
- a lambda function running on cloud, invoked periodically and automatically, uses existing account.json
to fetch location datalogin.py
- running locally, invoked by user to generate account.json
required by update.py
I can't handle re-login in update.py
because it needs to wait for user's 2FA input. If update.py
gets an 401 error, it can delete the account.json
and send an alert to user, stop there until it gets a new valid account.json
.
Oh no that shouldn't require doing the 2FA flow, I should've been more clear about that. Essentially, the login flow consists of the following steps:
mobileme
Information from that 3rd step is then used to fetch location reports. I think that redoing that 3rd step to obtain new tokens will fix the 401 issue, and it does not require doing the 2FA flow. So my proposed solution is to let the library attempt to do step 3 again if it notices that reauth is required, and raise some kind of UnauthenticatedError
if that fails.
Thanks for the clarification, your solution sounds good.
Hello, Seems that the library won't works anymore.... for every new location key I have the error below:
WARNING:root:Location report was not decodable. Some payloads have unknown variations leading to this error. Please report this full message at https://github.com/malmeloo/FindMy.py/issues/27. Payload: <Hidden By ME>, Original error: Unsupported elliptic curve point type
The last working report is 06/06/2024
I'm getting the following error for calling
AppleAccount.fetch_reports()
:The real issue is a 401 error with an empty response from iCloud API. May we have a meaningful exception so my code knows how to handle the re-login?