pyicloud
pyicloud copied to clipboard
Invalid authentication token. / Missing apple_id field
Running latest version, 1.0.
File ~/.pyenv/versions/3.10.2/lib/python3.10/site-packages/pyicloud/base.py:271, in PyiCloudService.__init__(self, apple_id, password, cookie_directory, verify, client_id, with_family)
265 except: # pylint: disable=bare-except
266 # Most likely a pickled cookiejar from earlier versions.
267 # The cookiejar will get replaced with a valid one after
268 # successful authentication.
269 LOGGER.warning("Failed to read cookiejar %s", cookiejar_path)
--> 271 self.authenticate()
273 self._drive = None
274 self._files = None
File ~/.pyenv/versions/3.10.2/lib/python3.10/site-packages/pyicloud/base.py:335, in PyiCloudService.authenticate(self, force_refresh, service)
332 msg = "Invalid email/password combination."
333 raise PyiCloudFailedLoginException(msg, error) from error
--> 335 self._authenticate_with_token()
337 self._webservices = self.data["webservices"]
339 LOGGER.debug("Authentication completed successfully")
File ~/.pyenv/versions/3.10.2/lib/python3.10/site-packages/pyicloud/base.py:357, in PyiCloudService._authenticate_with_token(self)
355 except PyiCloudAPIResponseException as error:
356 msg = "Invalid authentication token."
--> 357 raise PyiCloudFailedLoginException(msg, error) from error
PyiCloudFailedLoginException: ('Invalid authentication token.', PyiCloudAPIResponseException('Missing apple_id field'))
I'm using an iCloud account that is paired with 1 old iPhone that has not been turned on in a while (this has generally been fine).
I do not have 2FA set up on this account (deliberately so, it is only for iCloud).
I am not using app specific passwords.
Python 3.10.2.
As such, I don't think this is related to https://github.com/picklepete/pyicloud/issues/351 or https://github.com/picklepete/pyicloud/issues/349 ... but it might be.
I've tried this in a brand new environment with 3.10.2 as well. I can log into my account via iCloud.com just fine, not sure what's causing this oddity or if this is a bug.
Thank you for any help!
I am having the exact same issue, any progress on your side @zefoo ?
Hello, I meet problem like below :
Traceback (most recent call last):
File "C:\Code\syno\pyicloudtest.py", line 3, in <module>
api = PyiCloudService('[email protected]', 'xxx..')
File "C:\Users\xxx\AppData\Local\Programs\Python\Python39\lib\site-packages\pyicloud\base.py", line 271, in __init__
self.authenticate()
File "C:\Users\xxx\AppData\Local\Programs\Python\Python39\lib\site-packages\pyicloud\base.py", line 337, in authenticate
self._webservices = self.data["webservices"]
KeyError: 'webservices
Fixed like below, hope can help you:
- Go in file: ~/.pyenv/versions/3.10.2/lib/python3.10/site-packages/pyicloud/base.py
- Add
.cnto the url forHOME_ENDPOINTandSETUP_ENDPOINTparameters.
FYI: I got the same error message using a wrong password. Just sharing that here because the error is confusing in this case.
I also raised a separate issue for it: https://github.com/picklepete/pyicloud/issues/423
lol