Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icloudpd fails to authenticate to iCloud (iCloud Picture Downloader) #994

Open
LarsPoulsen opened this issue Nov 9, 2024 · 12 comments
Open
Labels

Comments

@LarsPoulsen
Copy link

Overview

Trying to download most recent picture from my iCloud camera roll, using command line
icloudpd -u [email protected] -p myPassWord! --recent 1 --folder-structure {:%Y/%m} --directory /pictures/Imports/username
on Fedora 40

Steps to Reproduce

See above

Expected Behavior

Expect to see one picture get downloaded

Actual Behavior

icloudpd -u [email protected] -p myPassWord! --recent 1 --folder-structure {:%Y/%m} --directory /pictures/Imports/Lars
2024-11-09 12:54:34 DEBUG Authenticating...
2024-11-09 12:54:35 ERROR Service Temporarily Unavailable (503)
Traceback (most recent call last):
File "pyicloud_ipd/base.py", line 357, in authenticate
File "requests/sessions.py", line 637, in post
File "pyicloud_ipd/base.py", line 134, in request
File "pyicloud_ipd/base.py", line 207, in _raise_error
pyicloud_ipd.exceptions.PyiCloudAPIResponseException: Service Temporarily Unavailable (503)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "starters/icloudpd.py", line 6, in
File "click/core.py", line 1157, in call
File "click/core.py", line 1078, in main
File "click/core.py", line 1434, in invoke
File "click/core.py", line 783, in invoke
File "icloudpd/base.py", line 328, in main
File "icloudpd/base.py", line 760, in core
File "icloudpd/authentication.py", line 31, in authenticate_
File "pyicloud_ipd/base.py", line 305, in init
File "pyicloud_ipd/base.py", line 365, in authenticate
pyicloud_ipd.exceptions.PyiCloudFailedLoginException: ('Invalid email/password combination.', PyiCloudAPIResponseException('Service Temporarily Unavailable (503)'))
[777119] Failed to execute script 'icloudpd' due to unhandled exception!

Context

This has worked recently. No significant updates recently (other than the incremental dnf updates that run daily).
Not cured by retries.
Not cured by removing folder ~/.pyicloud and its contents.
My iPhone did not get the 2FA prompts.

@LarsPoulsen LarsPoulsen added the bug label Nov 9, 2024
@petarlaf
Copy link

petarlaf commented Nov 9, 2024

I have the same issue since a few weeks ago:

icloudpd-1.23.4-windows-amd64.exe --username [email protected] --auth-only

I enter my password and I get the below. I double checked my password and I also login with these credentials at icloud.com - my account is not locked.

2024-11-09 22:32:10 DEBUG Authenticating...
iCloud Password:
2024-11-09 22:32:15 ERROR Service Temporarily Unavailable (503)
Traceback (most recent call last):
File "pyicloud_ipd\base.py", line 211, in authenticate
File "requests\sessions.py", line 637, in post
File "pyicloud_ipd\session.py", line 122, in request
File "pyicloud_ipd\session.py", line 196, in _raise_error
pyicloud_ipd.exceptions.PyiCloudAPIResponseException: Service Temporarily Unavailable (503)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "starters\icloudpd.py", line 6, in
File "click\core.py", line 1157, in call
File "click\core.py", line 1078, in main
File "click\core.py", line 1434, in invoke
File "click\core.py", line 783, in invoke
File "icloudpd\base.py", line 745, in main
File "icloudpd\base.py", line 1179, in core
File "icloudpd\authentication.py", line 53, in authenticate_
File "pyicloud_ipd\base.py", line 157, in init
File "pyicloud_ipd\base.py", line 219, in authenticate
pyicloud_ipd.exceptions.PyiCloudFailedLoginException: ('Invalid email/password combination.', PyiCloudAPIResponseException('Service Temporarily Unavailable (503)'))
[22268] Failed to execute script 'icloudpd' due to unhandled exception!

@HackerJL
Copy link

HackerJL commented Nov 9, 2024

I have been fighting with this for days. But along with a few other posts, the only way Ive had it work (and just fixed it 20 minutes ago myself) was to change my appleid password (which isn't a big deal cause it prompts you if you want to sign out of everything or not - I choose not). then re-ran the command and 2FA went through...

@AndreyNikiforov
Copy link
Collaborator

what version of icloudpd are you using?

@HackerJL
Copy link

what version of icloudpd are you using?

1.24.3. I updated to the new one last week which is what prompted my issues. I also found I had to delete the .pycloud folder from my home folder (Im on a Mac). Though not sure that was actually needed in truth.

@yaneury
Copy link

yaneury commented Nov 10, 2024

I think the issue is coming from the upstream pyicloud library: picklepete/pyicloud#456.

@petarlaf
Copy link

petarlaf commented Nov 10, 2024

what version of icloudpd are you using?

icloudpd-1.23.4 in my case

what version of icloudpd are you using?

1.24.3. I updated to the new one last week which is what prompted my issues. I also found I had to delete the .pycloud folder from my home folder (Im on a Mac). Though not sure that was actually needed in truth.

I will try today to reset my pw and see what happens. Although how does it make sense if the account is accesible from everywhere else (even private browser session and etc).. will report back

EDIT (again):

Ok I think on my end, at the end, changing the password and updating to 1.24.3 (from 1.23.4) worked. For some reason also my docker was failing to update itself and was using an old image so had to manually delete and redownload.

@AndreyNikiforov
Copy link
Collaborator

1.24.2 is the release where "Service Error 503" was [supposedly] fixed

@AndreyNikiforov
Copy link
Collaborator

I think the issue is coming from the upstream pyicloud library: picklepete/pyicloud#456.

We use forked version of that lib, but you are correct, that is the same issue

@LarsPoulsen
Copy link
Author

I uninstalled icloudpd and reinstalled it (1.24.3).
Problem has changed.
Now it starts authenticating, I get the 2FA prompt on my iPhone, and then it just hangs at
2024-11-10 14:10:30 DEBUG Authenticating...

Sometimes I get one more line of output

2024-11-10 14:05:17 DEBUG    Authenticating...
2024-11-10 14:05:18 ERROR    Authentication required for Account. (421)

So I still do not get logged in, much less start downloding.
And yes, I delete the .pyicloud folder. Made no difference.

@ildave
Copy link

ildave commented Nov 11, 2024

I have a similar issue, I just pulled the latest docker image, but I am getting this error when authenticating:

2024-11-11 08:15:13 DEBUG    Authenticating...
iCloud Password:
2024-11-11 08:15:21 ERROR    Authentication required for Account. (421)
Traceback (most recent call last):
  File "pyicloud_ipd/base.py", line 270, in authenticate
pyicloud_ipd.exceptions.PyiCloudAPIResponseException: {
  "serviceErrors" : [ {
    "code" : "-20101",
    "message" : "Enter the email or phone number and password for your Apple Account.",
    "suppressDismissal" : false
  } ]
} (401)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "starters/icloudpd_ex.py", line 122, in <module>
  File "starters/icloudpd_ex.py", line 118, in main
  File "click/core.py", line 1157, in __call__
  File "click/core.py", line 1078, in main
  File "click/core.py", line 1688, in invoke
  File "click/core.py", line 1434, in invoke
  File "click/core.py", line 783, in invoke
  File "icloudpd/base.py", line 745, in main
  File "icloudpd/base.py", line 1183, in core
  File "icloudpd/authentication.py", line 53, in authenticate_
  File "pyicloud_ipd/base.py", line 160, in __init__
  File "pyicloud_ipd/base.py", line 280, in authenticate
pyicloud_ipd.exceptions.PyiCloudFailedLoginException: ('Invalid email/password combination.', PyiCloudAPIResponseException('{\n  "serviceErrors" : [ {\n    "code" : "-20101",\n    "message" : "Enter the email or phone number and password for your Apple\xa0Account.",\n    "suppressDismissal" : false\n  } ]\n} (401)'))
[7] Failed to execute script 'icloudpd_ex' due to unhandled exception!

@CreativePR
Copy link

Still having the 401 error with one account only. Had user change the password and updated to Windows Version 1.24.3 Same error output as reported in version 1.24.0 version bug report

@iowk
Copy link
Contributor

iowk commented Nov 14, 2024

As @codebar33 reported gcobb321/icloud3#388 (comment), the password hash algorithm should depend on the protocol, which is in the response of signin/init.

Adding this implementation might help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants