Closed boredazfcuk closed 9 months ago
I'm having the same issue. Hoping it's a temporary problem with iCloud itself. I was able to log in just yesterday with iCloudPD, and my configuration has not changed since then.
Same issue as well, failure to login, even after changing password to something simple.
I can replicate the issue on docker with 1.16.3 without keyring, so it is general issue and most likely related to some changes on Apple side as my 1.16.3 was running for a number of days before the issue started.
Same here
Same here
also experiencing the same issue with 1.16.2 as well as after upgrading to 1.16.3
Same here
Same issue - container has stopped downloading today
Same issue here, stopped working yesterday Dec 6
Same. Following this thread for updates.
Following
Same here, following
Same, following;
I also get the same error on two different iCloud accounts. Suddenly stopped working 2 days ago. Both of my boredazfcuk/docker-icloudpd containers stopped and also manual execution of the script ~/.local/bin/icloudpd -u my@email.address -p ** -d . --folder-structure={:%Y/%m/%d} --delete-after-download fails with: _2023-12-07 23:24:36 DEBUG Authenticating... 2023-12-07 23:24:36 ERROR Unknown reason Traceback (most recent call last): File "pyicloud_ipd/base.py", line 220, in authenticate File "requests/sessions.py", line 637, in post File "pyicloud_ipd/base.py", line 105, in request File "pyicloud_ipd/base.py", line 127, in _raise_error pyicloud_ipd.exceptions.PyiCloudAPIResponseError: Unknown reason
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "starters/icloudpd.py", line 5, 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 317, in main File "icloudpd/base.py", line 744, in core File "icloudpd/authentication.py", line 31, in authenticate_ File "pyicloud_ipd/base.py", line 204, in init File "pyicloud_ipd/base.py", line 228, in authenticate pyicloudipd.exceptions.PyiCloudFailedLoginException: ('Invalid email/password combination.', PyiCloudAPIResponseError('Unknown reason')) [1357605] Failed to execute script 'icloudpd' due to unhandled exception!
Logging in on the icloud.com website works as it should. Does this mean there is no remedy for this problem yet? Has Apple changed something?
Same, following;
just following.
just following.
Then please just please subscribe, nobody wants to get spammed with "just following" updates!
Hi, maybe it will help to solve the problem. I have three icloud Accounts running and the issue is the same in every account.
icloudpd --directory /xxx/xxx/xxx/icloudpd_photo_backup --username xxxxxxxxxxxxx@icloud.com --password xxxxxxxx --log-level debug 2023-12-08 16:16:11 DEBUG Authenticating... 2023-12-08 16:16:12 ERROR Unknown reason Traceback (most recent call last): File "pyicloud_ipd/base.py", line 220, in authenticate File "requests/sessions.py", line 637, in post File "pyicloud_ipd/base.py", line 105, in request File "pyicloud_ipd/base.py", line 127, in _raise_error pyicloud_ipd.exceptions.PyiCloudAPIResponseError: Unknown reason
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "starters/icloudpd.py", line 5, in
I'm experiencing this too. Started on the 6th at around 5pm EST.
I see the following paths:
icloudpd
uses (they support OAUTH on web for some time)Is anybody interested in 1) and/or 2)? I plan to allocate some time in the next number of days to look into this issue and will invest in 1 & 3. IMO it is okay for multiple ppl to look at the same path as there are always edge cases and different approaches that may give different or complementing outcomes.
@AndreyNikiforov Thanks for the summary / plans of attack.
To help guide others that may want to debug, a possible good test case to try is within the tests/test_authentication.py
tests, test_2sa_required
. Per the instructions in the code, one can delete the pre-recorded VCR response file tests/vcr_cassettes/auth_requires_2sa.yml
, and fill in their actual username/password in the test, and then run scripts/test
(SEE https://github.com/icloud-photos-downloader/icloud_photos_downloader/blob/master/CONTRIBUTING.md#setting-up-the-development-environment on how to setup your local environment to test this code)
The tests will fail, and the VCR recording (aka "cassette") will be updated with the actual response received from icloud.
BE SURE TO NOT SHARE YOUR USERNAME/PASSWORD WHICH ARE PRESENT IN THE VCR RECORDING!
For instance, after doing the above, this is the diff of the VCR cassette. I can't glean much useful information from the response yet:
However, the HTTP response code of "421: Misdirected Request" may be the key, and indicate that icloud has updated its API and therefore pyicloud needs updating to reflect that.
Back in Oct 2023, someone submitted an issue to pyicloud regarding the 421 response: https://github.com/picklepete/pyicloud/issues/441, and 4 days ago there is a possible fix: https://github.com/picklepete/pyicloud/issues/406 (it's not merged yet)
My system:
Total speculation but I wonder if this has anything to do with Apple's attempts to block iMessage on Android;
https://www.theverge.com/2023/12/8/23994089/apple-beeper-mini-android-blocked-imessage-app
My guess is that it has something to do with the recent support for passkey logins. At least for the iCloud website it asks for passkey and logging in via password takes one more click.
Such a thing would be unusual for an api, nevertheless a change that requires specification of the desired login method sounds very likely.
My guess is that it has something to do with the recent support for passkey logins. At least for the iCloud website it asks for passkey and logging in via password takes one more click.
Such a thing would be unusual for an api, nevertheless a change that requires specification of the desired login method sounds very likely.
This sounds like the issue for me...
Same error here running on Windows x64 with 1.16.3 version
Same issue for me as well, docker that was previously working fine has now failed authorization today as well, and I haven't been able to authorize one for 3 days.
This looks related to beeper mini being blocked. ๐
I see the following paths:
- dig into current code/protocol to see if minor tweak will make it working
- rationale: fastest and least invasive
- concerns: low chances
- chances: low; suspect Apple turned off old protocol that
icloudpd
uses (they support OAUTH on web for some time)- investments: low
- use original pyicloud lib
- rationale: IIUC pyicloud was updated to support OAUTH some time ago
- concerns: may break some of our code
- chances: mid-high; need to confirm that pyicloud works with current Apple services first
- investments: mid; need to update tests and that has been a challenge in the prev attempts to bring latest pyicloud
[ . . . ]
Is anybody interested in 1) and/or 2)? I plan to allocate some time in the next number of days to look into this issue and will invest in 1 & 3. IMO it is okay for multiple ppl to look at the same path as there are always edge cases and different approaches that may give different or complementing outcomes.
If it helps, I was able to verify the current 1.0.0 version of pyicloud works as is. I was able to instantiate a PyiCloudService and list albums (pyicloud,photos.albums).
Potentially doing a combination of path 1) and 2) may be an option - possibly just focusing on merging over the key authentication pieces from the 1.0.0 pyicloud.
If it helps, I was able to verify the current 1.0.0 version of pyicloud works as is. I was able to instantiate a PyiCloudService and list albums (pyicloud,photos.albums).
I was noticing that as well. icloud_photos_downloader
uses some customized versions of pyicloud
code to be compatible with China vs US icloud domains. It's possible those customizations are now causing some issues, and may not be updated with the latest code from pyicloud
.
I think changes would have to be made to the following files:
src/pyicloud_ipd/base.py
icloud_photos_downloader
to switch between US and China icloud domain names. That will have to be addressed.src/icloudpd/authentication.py
pyicloud_ipd.PyiCloudService(...)
with correct arguments, removing "domain" from the arg list, etc.src/pyicloud_ipd/exceptions.py
I've not tested these changes in a docker container yet.
following - thanks
Thanks a lot. Because, all this have a "family" impact. I need to have my dear photos and videos close to me on my NAS. If I can contribute one way or the other I will. Thanks a looooooot. Merci ๐ค.
There is hope for a fix, and would appreciate others testing if they have a chance: https://github.com/icloud-photos-downloader/icloud_photos_downloader/pull/733
Notes:
I've had success running a docker container and pulling down all photos/movies from my iCloud photo library:
docker build . -t icloudpd_dev
docker run -it \
--rm --name icloudpd \
-v ~/icloudpd-download:/data \
-e TZ=America/New_York \
icloudpd_dev \
icloudpd \
--directory /data \
--username my-email@example.com \
--watch-with-interval 3600
2023-12-09 16:23:42 DEBUG Authenticating...
iCloud Password:
2023-12-09 16:24:00 INFO Two-factor authentication is required
Please enter two-factor authentication code: 123456
2023-12-09 16:24:07 WARNING Failed to parse response with JSON mimetype
2023-12-09 16:24:10 INFO Great, you're all set up. The script can now be run without user interaction until 2SA expires.
You can set up email notifications for when the two-step authentication expires.
(Use --help to view information about SMTP options.)
2023-12-09 16:24:13 DEBUG Looking up all photos and videos from album All Photos...
2023-12-09 16:24:13 INFO Downloading 81324 original photos and videos to /data ...
2023-12-09 16:24:16 DEBUG Downloading /data/2023/12/09/IMG_1083.MOV...
2023-12-09 16:24:18 INFO Downloaded /data/2023/12/09/IMG_1083.MOV
2023-12-09 16:24:18 DEBUG Downloading /data/2023/12/09/IMG_1082.JPG...
Hi,
the fix almost works. I have not configured a domain, and the current auth_fix
branch fails with this error:
[...]
File "/home/xxxx/.local/lib/python3.11/site-packages/pyicloud_ipd/base.py", line 393, in _authenticate_with_token
domain_to_use = req.get('domainToUse')
^^^^^^^
AttributeError: 'Response' object has no attribute 'get'
I have not fully understood what the req.get
statement is supposed to do and expect there should be some kind of key check first.
My temporary fix is
domain_to_use = None
try:
domain_to_use = req.get('domainToUse')
except AttributeError as error:
print("domainToUse attribute not found.")
With this, I am able to download my icloud photos again ๐
Hi,
the fix almost works. I have not configured a domain, and the current
auth_fix
branch fails with this error:[...] File "/home/xxxx/.local/lib/python3.11/site-packages/pyicloud_ipd/base.py", line 393, in _authenticate_with_token domain_to_use = req.get('domainToUse') ^^^^^^^ AttributeError: 'Response' object has no attribute 'get'
I have not fully understood what the
req.get
statement is supposed to do and expect there should be some kind of key check first.[ . . . ]
I've fixed this in the latest commit. The get function will handle missing keys gracefully, unfortunately, it was being called on an object that doesn't have the method - so even if the key existed, it would still fail with the AttributeError
req.json()
does have the get
method (as it returns a dictionary), and that is set to self.data
just above, so calling self.data.get("domainToUse")
should return None
if it doesn't exist in the response.
@scaraebeus' fix worked for me. Built a local docker image and successfully grabbed my photos from two accounts! ๐
It didn't work for me at first. I ran it with:
docker run -it --rm -v $(pwd)/mynas/Photos/iCloudBackup:/data -e TZ=America/New_York icloudpd icloudpd --directory /data --username myemail@mail.com
I had the following error:
pyicloud_ipd.exceptions.PyiCloudNoStoredPasswordAvailableException: No pyicloud password for myemail@mail.com could be found in the system keychain. Use the `--store-in-keyring` command-line option for storing a password for this username.
But I just needed something quick and dirty to do a backup so I hardcoded my password in base.py
and it worked.
@Braincoke
You need to supply your own email to the docker run
command:
docker run -it \
--rm \
-v $(pwd)/mynas/Photos/iCloudBackup:/data \
-e TZ=America/New_York \
icloudpd icloudpd --directory /data --username myemail@mail.com
You can see that in the command above, I pass a dummy email, --username myemail@mail.com
You would want to replace that with your actual apple id email.
Thanks @cfurrow, I did pass my real apple ID to the command.
@Braincoke - I took a quick look and the icloudpd auth flow should prompt for a password if it's not supplied in the command line --password your_password
and also not found in the keyring.
With the changes in the pyicloud
exception names, this exception isn't being caught by icloudpd to prompt for the password. It was previously looking for pyicloud_ipd.exceptions.NoStoredPasswordAvailable
and should now be looking for pyicloud_ipd.exceptions.PyiCloudNoStoredPasswordAvailableException
.
I'll review the pyicloud
exceptions referenced throughout icloudpd
and update.
I am on unraid and hence cant test any of this stuff being reported, but looking forward to testing it once an update goes to the unraid app store.
้ๅฐไบๅๆ ท้ฎ้ข
The docker solution does not seem to work for me: I'm still getting invalid email/password combo when attempting this via a build docker container:
560 git clone https://github.com/icloud-photos-downloader/icloud_photos_downloader.git
561 cd icloud_photos_downloader/
562 ls
563 docker build . -t icloudpd_dev
564 history
565 docker run -it --rm --name icloudpd -v ~/Pictures/Photos:/data -e TZ=America/Vancouver icloudpd_dev icloudpd --directory /data --username my@email.com --watch-with-interval 1800
2023-12-12 07:35:41 DEBUG Authenticating...
iCloud Password:
2023-12-12 07:35:44 ERROR Unknown reason
Traceback (most recent call last):
File "pyicloud_ipd/base.py", line 220, in authenticate
File "requests/sessions.py", line 637, in post
File "pyicloud_ipd/base.py", line 105, in request
File "pyicloud_ipd/base.py", line 127, in _raise_error
pyicloud_ipd.exceptions.PyiCloudAPIResponseError: Unknown reason
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "starters/icloudpd_ex.py", line 110, in <module>
File "starters/icloudpd_ex.py", line 106, 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 317, in main
File "icloudpd/base.py", line 744, in core
File "icloudpd/authentication.py", line 31, in authenticate_
File "pyicloud_ipd/base.py", line 204, in __init__
File "pyicloud_ipd/base.py", line 228, in authenticate
pyicloud_ipd.exceptions.PyiCloudFailedLoginException: ('Invalid email/password combination.', PyiCloudAPIResponseError('Unknown reason'))
[8] Failed to execute script 'icloudpd_ex' due to unhandled exception!
~/.src/icloud_photos_downloader $>
i successfully logged into icloud via browser to confirm that I wasn't fat-fingering my password.
The docker solution does not seem to work for me: I'm still getting invalid email/password combo when attempting this via a build docker container:
The master branch has yet to be updated. One proposed solution is available in PR #734.
@winteriscariot I think you're not getting the repo with the fix. The PR that is waiting to merge is https://github.com/scaraebeus/icloud_photos_downloader.git right now.
Also, this don't work for me. I've got the same error:
git clone https://github.com/scaraebeus/icloud_photos_downloader.git
docker build . -t icloudpd_scarabeus --no-cache
docker run -it --rm --name icloudpd -v /tmp/icloudpd-download:/data -e TZ=America/New_York icloudpd_scarabeus icloudpd --directory /data --username USER@DOMAIN.COM --watch-with-interval 3600 --password "PASSWORD"
2023-12-12 11:24:26 DEBUG Authenticating...
2023-12-12 11:24:27 ERROR Unknown reason
Traceback (most recent call last):
File "pyicloud_ipd/base.py", line 220, in authenticate
File "requests/sessions.py", line 637, in post
File "pyicloud_ipd/base.py", line 105, in request
File "pyicloud_ipd/base.py", line 127, in _raise_error
pyicloud_ipd.exceptions.PyiCloudAPIResponseError: Unknown reason
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "starters/icloudpd_ex.py", line 110, in <module>
File "starters/icloudpd_ex.py", line 106, 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 317, in main
File "icloudpd/base.py", line 744, in core
File "icloudpd/authentication.py", line 31, in authenticate_
File "pyicloud_ipd/base.py", line 204, in __init__
File "pyicloud_ipd/base.py", line 228, in authenticate
pyicloud_ipd.exceptions.PyiCloudFailedLoginException: ('Invalid email/password combination.', PyiCloudAPIResponseError('Unknown reason'))
[7] Failed to execute script 'icloudpd_ex' due to unhandled exception!
@lcmartos git checkout auth_fix
@michaelmolino Working! Thank you! I suppose it's just a matter of time before they try and accept the patch.
I got it working too - following steps did the trick for me (checking out the head "auth_fix" is the trick really): wget https://github.com/scaraebeus/icloud_photos_downloader/archive/refs/heads/auth_fix.zip mv auth_fix auth_fix.zip unzip auth_fix docker build . -t icloudpd_dev docker run -it --rm --name icloudpd -v /mnt/fotos:/data -e TZ=America/Vancouver icloudpd_dev icloudpd --directory /data --username mail@mail.com --watch-with-interval 1800 --password XXX
I got it working too - following steps did the trick for me (checking out the head "auth_fix" is the trick really): wget https://github.com/scaraebeus/icloud_photos_downloader/archive/refs/heads/auth_fix.zip mv auth_fix auth_fix.zip unzip auth_fix docker build . -t icloudpd_dev docker run -it --rm --name icloudpd -v /mnt/fotos:/data -e TZ=America/Vancouver icloudpd_dev icloudpd --directory /data --username mail@mail.com --watch-with-interval 1800 --password XXX
I followed these steps and get the error Missing apple_id field
:
2023-12-12 16:03:27 DEBUG Authenticating...
2023-12-12 16:03:28 ERROR Missing apple_id field
Traceback (most recent call last):
File "pyicloud_ipd/base.py", line 365, in _authenticate_with_token
File "requests/sessions.py", line 637, in post
File "pyicloud_ipd/base.py", line 156, in request
File "pyicloud_ipd/base.py", line 185, in _raise_error
pyicloud_ipd.exceptions.PyiCloudAPIResponseException: Missing apple_id field
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "starters/icloudpd_ex.py", line 110, in <module>
File "starters/icloudpd_ex.py", line 106, 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 317, in main
File "icloudpd/base.py", line 744, in core
File "icloudpd/authentication.py", line 31, in authenticate_
File "pyicloud_ipd/base.py", line 283, in __init__
File "pyicloud_ipd/base.py", line 345, in authenticate
File "pyicloud_ipd/base.py", line 371, in _authenticate_with_token
pyicloud_ipd.exceptions.PyiCloudFailedLoginException: ('Invalid authentication token.', PyiCloudAPIResponseException('Missing apple_id field'))
[7] Failed to execute script 'icloudpd_ex' due to unhandled exception!
I'm sure this is basic user error on my part but I thought I would share in case it isn't.
I also have to pass the password as an option. If I don't, it complains that it isn't in the keyfile.
I followed these steps and get the error
Missing apple_id field
:[ . . . ]
I'm sure this is basic user error on my part but I thought I would share in case it isn't.
I also have to pass the password as an option. If I don't, it complains that it isn't in the keyfile.
I'm not sure all of the ways this error can manifest - so this may not apply, however, in some of my testing I was able to get this error if passing an invalid username and/or incorrect password. May want to double check there are no typos there.
I got it working too - following steps did the trick for me (checking out the head "auth_fix" is the trick really): wget https://github.com/scaraebeus/icloud_photos_downloader/archive/refs/heads/auth_fix.zip mv auth_fix auth_fix.zip unzip auth_fix docker build . -t icloudpd_dev docker run -it --rm --name icloudpd -v /mnt/fotos:/data -e TZ=America/Vancouver icloudpd_dev icloudpd --directory /data --username mail@mail.com --watch-with-interval 1800 --password XXX
that worked for me and photos are syncing again. Thanks so much everyon for the great and quick team work on this one. Cheers.
Overview
As of about 45mins ago, all four of my containers attempted a download, and all four failed to login.
After removing the keyring file and attempting to recreate it with
icloud --username my@email.com
the password is rejected. I've confirmed the e-mail and password combination is correct.Steps to Reproduce
Expected Behavior
Logs into icloud
Actual Behavior
Fails to login. If password is saved to the keyring, this error is generated:
Context
Seems that Apple may have changed something. Can replicate on Alpine Linux 3.18.3 icloudpd 1.16.2 and Alpine Linux 3.18.5 and icloudpd 1.16.3