mandarons / icloudpy

iCloud web service interface library in Python
Other
188 stars 19 forks source link

[BUG]error 503 #48

Open antonleonov1983 opened 3 days ago

antonleonov1983 commented 3 days ago

I get error 503 when running api = ICloudPyService('email', 'pass')

I looked at the request that the script makes:

https://idmsa.apple.com/appleauth/auth/signin?isRememberMeEnabled=true POST /appleauth/auth/signin?isRememberMeEnabled=true HTTP/1.1 Host: idmsa.apple.com User-Agent: python-requests/2.28.1 Accept-Encoding: gzip, deflate Accept: / Connection: close Origin: https://www.icloud.com Referer: https://www.icloud.com/ Content-Type: application/json X-Apple-OAuth-Client-Id: d39ba9916b7251055b22c7f910e2ea796ee65e98b2ddecea8f5dde8d9d1a815d X-Apple-OAuth-Client-Type: firstPartyAuth X-Apple-OAuth-Redirect-URI: https://www.icloud.com X-Apple-OAuth-Require-Grant-Code: true X-Apple-OAuth-Response-Mode: web_message X-Apple-OAuth-Response-Type: code X-Apple-OAuth-State: auth-e7354889-8e1c-11ef-9432-080027e13d28 X-Apple-Widget-Key: d39ba9916b7251055b22c7f910e2ea796ee65e98b2ddecea8f5dde8d9d1a815d Content-Length: 105

{"accountName": "xxx@icloud.com", "password": "xxx", "rememberMe": true, "trustTokens": []}

Service Temporarily Unavailable (503) What could be the reason? Is there any original service or application now that makes a similar request?

14278358 commented 2 days ago

C:\Users\5257\Desktop\PyCharm\pythonProject.venv\Scripts\python.exe C:\Users\5257\Desktop\PyCharm\pythonProject\2.0000000000\设备名称.py 登录失败: ('Invalid email/password combination.', ICloudPyAPIResponseException('Service Temporarily Unavailable (503)'))

tbi880 commented 2 days ago

same here

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/Users/tianyuanbi/Downloads/icloudpy/.venv/lib/python3.9/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started target(sockets=sockets) File "/Users/tianyuanbi/Downloads/icloudpy/.venv/lib/python3.9/site-packages/uvicorn/server.py", line 65, in run return asyncio.run(self.serve(sockets=sockets)) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/Users/tianyuanbi/Downloads/icloudpy/.venv/lib/python3.9/site-packages/uvicorn/server.py", line 69, in serve await self._serve(sockets) File "/Users/tianyuanbi/Downloads/icloudpy/.venv/lib/python3.9/site-packages/uvicorn/server.py", line 76, in _serve config.load() File "/Users/tianyuanbi/Downloads/icloudpy/.venv/lib/python3.9/site-packages/uvicorn/config.py", line 434, in load self.loaded_app = import_from_string(self.app) File "/Users/tianyuanbi/Downloads/icloudpy/.venv/lib/python3.9/site-packages/uvicorn/importer.py", line 19, in import_from_string module = importlib.import_module(module_str) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 855, in exec_module File "", line 228, in _call_with_frames_removed File "/Users/tianyuanbi/Downloads/icloudpy/main.py", line 33, in api = ICloudPyService('id, 'pswd', home_endpoint="https://www.icloud.com.cn", File "/Users/tianyuanbi/Downloads/icloudpy/icloudpy/base.py", line 279, in init self.authenticate() File "/Users/tianyuanbi/Downloads/icloudpy/icloudpy/base.py", line 346, in authenticate raise ICloudPyFailedLoginException(msg, error) from error icloudpy.exceptions.ICloudPyFailedLoginException: ('Invalid email/password combination.', ICloudPyAPIResponseException('Service Temporarily Unavailable (503)'))

Verkhovskyi commented 1 day ago

Similar issues with icloud-docker, that's based on icloudpy

mpepping commented 1 day ago

Same thing for me after upgrading from 1.18.0 to 1.20.1 (and making all required config changes). 503's when logging in with 2FA. Now, moving back to 1.18.0, login still throws the 503's.

Here some debug logging from 1.18.0 .. the error is mostly the same for 1.20.1:

icloud    | Loading config from /app/config.yaml ...
icloud    | Loading config from /app/config.yaml ...
icloud    | 2024-10-21 19:29:28,752 :: DEBUG :: root :: config_parser.py :: 111 :: Checking root destination ...
icloud    | 2024-10-21 19:29:28,772 :: DEBUG :: urllib3.connectionpool :: connectionpool.py :: 1019 :: Starting new HTTPS connection (1): wapar-api.mandarons.com:443
icloud    | 2024-10-21 19:29:29,382 :: DEBUG :: urllib3.connectionpool :: connectionpool.py :: 474 :: https://wapar-api.mandarons.com:443 "POST /api/installation HTTP/1.1" 201 45
icloud    | 2024-10-21 19:29:29,419 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading Gnome
icloud    | 2024-10-21 19:29:29,440 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading Google
icloud    | 2024-10-21 19:29:29,497 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading Windows (alt)
icloud    | 2024-10-21 19:29:29,502 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading file
icloud    | 2024-10-21 19:29:29,504 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading keyczar
icloud    | 2024-10-21 19:29:29,505 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading multi
icloud    | 2024-10-21 19:29:29,506 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading pyfs
icloud    | 2024-10-21 19:29:29,509 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading KWallet
icloud    | 2024-10-21 19:29:29,512 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading SecretService
icloud    | 2024-10-21 19:29:29,558 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading Windows
icloud    | 2024-10-21 19:29:29,561 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading chainer
icloud    | 2024-10-21 19:29:29,562 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading libsecret
icloud    | 2024-10-21 19:29:29,565 :: DEBUG :: keyring.backend :: backend.py :: 201 :: Loading macOS
icloud    | 2024-10-21 19:29:29,585 :: DEBUG :: icloudpy.base :: base.py :: 246 :: Using session file session_data/meexamplecom.session
icloud    | 2024-10-21 19:29:29,586 :: INFO :: icloudpy.base :: base.py :: 253 :: Session file does not exist
icloud    | 2024-10-21 19:29:29,587 :: DEBUG :: icloudpy.base :: base.py :: 318 :: Authenticating as me@example.com
icloud    | 2024-10-21 19:29:29,698 :: DEBUG :: icloudpy.base.http :: base.py :: 75 :: POST https://idmsa.apple.com/appleauth/auth/signin {"accountName": "me@example.com", "password": "********", "rememberMe": true, "trustTokens": []}
icloud    | 2024-10-21 19:29:29,702 :: DEBUG :: urllib3.connectionpool :: connectionpool.py :: 1019 :: Starting new HTTPS connection (1): idmsa.apple.com:443
icloud    | 2024-10-21 19:29:30,445 :: DEBUG :: urllib3.connectionpool :: connectionpool.py :: 474 :: https://idmsa.apple.com:443 "POST /appleauth/auth/signin?isRememberMeEnabled=true HTTP/1.1" 503 190
icloud    | 2024-10-21 19:29:30,447 :: DEBUG :: icloudpy.base :: base.py :: 94 :: Saved session data to file
icloud    | 2024-10-21 19:29:30,448 :: DEBUG :: icloudpy.base :: base.py :: 98 :: Cookies saved to session_data/meexamplecom
icloud    | 2024-10-21 19:29:30,448 :: ERROR :: icloudpy.base :: base.py :: 186 :: Service Temporarily Unavailable (503)
icloud    | Traceback (most recent call last):
icloud    |   File "/app/venv/lib/python3.10/site-packages/icloudpy/base.py", line 336, in authenticate
icloud    |     self.session.post(
icloud    |   File "/app/venv/lib/python3.10/site-packages/requests/sessions.py", line 635, in post
icloud    |     return self.request("POST", url, data=data, json=json, **kwargs)
icloud    |   File "/app/venv/lib/python3.10/site-packages/icloudpy/base.py", line 131, in request
icloud    |     self._raise_error(response.status_code, response.reason)
icloud    |   File "/app/venv/lib/python3.10/site-packages/icloudpy/base.py", line 187, in _raise_error
icloud    |     raise api_error
icloud    | icloudpy.exceptions.ICloudPyAPIResponseException: Service Temporarily Unavailable (503)
icloud    |
icloud    | The above exception was the direct cause of the following exception:
icloud    |
icloud    | Traceback (most recent call last):
icloud    |   File "/app/./src/main.py", line 7, in <module>
icloud    |     sync.sync()
icloud    |   File "/app/src/sync.py", line 74, in sync
icloud    |     api = get_api_instance(
icloud    |   File "/app/src/sync.py", line 40, in get_api_instance
icloud    |     else ICloudPyService(
icloud    |   File "/app/venv/lib/python3.10/site-packages/icloudpy/base.py", line 277, in __init__
icloud    |     self.authenticate()
icloud    |   File "/app/venv/lib/python3.10/site-packages/icloudpy/base.py", line 344, in authenticate
icloud    |     raise ICloudPyFailedLoginException(msg, error) from error
icloud    | icloudpy.exceptions.ICloudPyFailedLoginException: ('Invalid email/password combination.', ICloudPyAPIResponseException('Service Temporarily Unavailable (503)'))

Wiping the session_data directory does not make a difference.

Alion548 commented 12 hours ago

https://github.com/fastlane/fastlane/pull/26415

alxgarci commented 11 hours ago

It is an issue for everyone, apple changed the authentication system to a 'sirp' method. In other repo issue https://github.com/fastlane/fastlane/issues/26368 looks already solved. So looking important right now!