icloudpy.exceptions.ICloudPyFailedLoginException: ('Invalid authentication token.', ICloudPyAPIResponseException('Missing apple_id field'))
I got the following exception when I ran it
Traceback (most recent call last):
File "C:\Work\Env\python\Lib\site-packages\icloudpy\base.py", line 364, in _authenticate_with_token
req = self.session.post(
File "C:\Work\Env\python\Lib\site-packages\requests\sessions.py", line 637, in post
return self.request("POST", url, data=data, json=json, **kwargs)
File "C:\Work\Env\python\Lib\site-packages\icloudpy\base.py", line 158, in request
self._raise_error(code, reason)
File "C:\Work\Env\python\Lib\site-packages\icloudpy\base.py", line 187, in _raise_error
raise api_error
icloudpy.exceptions.ICloudPyAPIResponseException: Missing apple_id field
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Work\pythonProjects\demo\pythonProject\find-my-phone-demo-02.py", line 4, in <module>
api = ICloudPyService('*****', '******', home_endpoint="https://www.icloud.com.cn",setup_endpoint="https://setup.icloud.com.cn/setup/ws/1",)
File "C:\Work\Env\python\Lib\site-packages\icloudpy\base.py", line 279, in __init__
self.authenticate()
File "C:\Work\Env\python\Lib\site-packages\icloudpy\base.py", line 348, in authenticate
self._authenticate_with_token()
File "C:\Work\Env\python\Lib\site-packages\icloudpy\base.py", line 370, in _authenticate_with_token
raise ICloudPyFailedLoginException(msg, error) from error
icloudpy.exceptions.ICloudPyFailedLoginException: ('Invalid authentication token.', ICloudPyAPIResponseException('Missing apple_id field'))
How can I test it to make it work?
Here is my run test code
from icloudpy import ICloudPyService
# api = ICloudPyService('[email protected]', 'password')
# For China region
api = ICloudPyService('13925629668', 'xrf64668', home_endpoint="https://www.icloud.com.cn",setup_endpoint="https://setup.icloud.com.cn/setup/ws/1",)
if __name__ == '__main__':
print(api)
Try providingcookie_directory parameter pointing to some local directory path. Also, double check username and password. Username should be your icloud email address and password should be icloud.com password (and not application password).
尝试提供
cookie_directory指向某个本地目录路径的参数。另外,请仔细检查用户名和密码。用户名应该是您的 icloud 电子邮件地址,密码应该是 icloud.com 密码(而不是应用程序密码)。
Encountered the same problem, and this happened again for accounts without 2FA authentication.
Do you have 2FA enabled? If not, try enabling it and see if that resolves the problem.
@mandarons i meet the same problem. Regin china wrong,but if i change to us account,it's right.
Thanks, I'll test it again.
Thanks, I'll test it again.
i said that i meet the same problem.have you solved the problem?how to do. it seems something modified since last year between china region and oversea
It has no effect.