skarppi / icloud_photo_station

A command-line tool to download photos from iCloud to Synology NAS.
114 stars 12 forks source link

Help with two factor authencation #21

Closed cmfrazier closed 8 months ago

cmfrazier commented 3 years ago

So do I simply ssh into my DSM and run the following?

source /volume1/@appstore/icloud_photo_station/env/bin/activate
python /volume1/@appstore/icloud_photo_station/app/icloudpd.py \
--username REDACTED \
--password REDACTED \
--directory /volume1/Photos/Curtis

When I do that I get the following:

2021-08-23 20:53:43 DEBUG    Authenticating...
Traceback (most recent call last):
  File "/volume1/@appstore/icloud_photo_station/app/icloudpd.py", line 5, in <module>
    main()
  File "/volume1/@appstore/icloud_photo_station/env/lib/python3.8/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/volume1/@appstore/icloud_photo_station/env/lib/python3.8/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/volume1/@appstore/icloud_photo_station/env/lib/python3.8/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/volume1/@appstore/icloud_photo_station/env/lib/python3.8/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/volume1/@appstore/icloud_photo_station/app/icloudpd/base.py", line 255, in main
    icloud = authenticate(
  File "/volume1/@appstore/icloud_photo_station/app/icloudpd/authentication.py", line 29, in authenticate
    icloud = pyicloud_ipd.PyiCloudService(
  File "/volume1/@appstore/icloud_photo_station/env/lib/python3.8/site-packages/pyicloud_ipd/base.py", line 193, in __init__
    self.authenticate()
  File "/volume1/@appstore/icloud_photo_station/env/lib/python3.8/site-packages/pyicloud_ipd/base.py", line 222, in authenticate
    os.mkdir(self._cookie_directory)
FileNotFoundError: [Errno 2] No such file or directory: '/var/services/homes/cmfrazier/.pyicloud'

I also know it's connecting to Apple as I get a code sent to my devices....I'm just unsure where to enter the code. Thanks

skarppi commented 3 years ago

The script should just ask for text input. Maybe your home directory is missing or something because it crashes for FileNotFoundError when trying to create the cookie directory (~/.pyicloud).

Here is an example how it should look like:

2021-08-24 09:47:29 DEBUG    Authenticating...
2021-08-24 09:47:31 INFO     Two-step/two-factor authentication is required!
  0: SMS to *******XX
  1: Enter two-factor authentication code
Please choose an option: [0]: 1
Please enter two-factor authentication code: XXXXXX
2021-08-24 09:50:27 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.)
2021-08-24 09:50:28 DEBUG    Looking up all photos and videos from album All Photos...