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

ERROR Cookie does not exist. #50

Closed
justinrhodes opened this issue Dec 16, 2020 · 7 comments
Closed

ERROR Cookie does not exist. #50

justinrhodes opened this issue Dec 16, 2020 · 7 comments

Comments

@justinrhodes
Copy link

I'm hitting this issue after setting up the Docker container. I have set up the 2FA keyring and it's successful:
2020-12-16 19:04:02 INFO Two factor authentication cookie generated. Sync should now be successful.

but after restarting the Docker I am seeing this:

2020-12-16 19:04:19 INFO Check 2FA Cookie
2020-12-16 19:04:19 ERROR Cookie does not exist. Please run container interactively to generate - Retry in 5 minutes
@boredazfcuk
Copy link
Owner

Is the cookie showing in your /config directory? It should be your e-mail address, but with special characters removed.

When you add your account to the keyring, it should prompt you to confirm via SMS. It will then generate a 2FA cookie and you'll be prompted again, the second time will give you an option of SMS, or the 2FA feature on your iPhone/iPad.

Are you sure you have 2FA enabled on your account? Do you get prompted to confirm 2FA when logging in to iCloud.com?

@justinrhodes
Copy link
Author

Is the cookie showing in your /config directory? It should be your e-mail address, but with special characters removed.

Yes, it's in there.

When you add your account to the keyring, it should prompt you to confirm via SMS. It will then generate a 2FA cookie and you'll be prompted again, the second time will give you an option of SMS, or the 2FA feature on your iPhone/iPad.

Yep, I get the first and second prompt (SMS and then 2FA code on my Mac)

Are you sure you have 2FA enabled on your account? Do you get prompted to confirm 2FA when logging in to iCloud.com?

Yes it does.

@boredazfcuk
Copy link
Owner

boredazfcuk commented Dec 16, 2020

When the container launches, it should display the cookie path in the log e.g:

2020-12-14 18:51:18 INFO     Apple ID password: usekeyring
2020-12-14 18:51:18 INFO     Authentication Type: 2FA
2020-12-14 18:51:18 INFO     Cookie path: /config/notmyemailaddresscom
2020-12-14 18:51:18 INFO     Cookie expiry notification period: 7

Does your path Cookie path: /config/notmyemailaddresscom file location exactly match the path of the cookie inside the container?

There has been issues with underscores and other special characters in e-mail addresses not being handled correctly. It may be a special character in your e-mail address that hasn't been accounted for.

@justinrhodes
Copy link
Author

I believe that was the issue. I re-entered my email in the Docker config without any capitalization and it's working. I believe because I was using a capital letter in my email it was using that for the Cookie path name and not looking for that exact match when restarting the docker container.

Not sure if this is something you want to change or add a note about.

@boredazfcuk
Copy link
Owner

It should already handle uppercase characters. It calculates the cookie name like this:

cookie="$(echo -n "${apple_id//[^a-zA-Z0-9_]/}" | tr '[:upper:]' '[:lower:]')"

Basically it takes the Apple ID, filters out anything that isn't a-z, A-Z, 0-9 or an underscore and hands to over to the tr command. tr then changes all uppercase letters to lowercase.

Was the cookie file created with the capital letter then?

@justinrhodes
Copy link
Author

Yes, the cookie file had the capital letter in it.
I was creating the docker and using my email address to set up. This is when I typed in my email with capital letters.

@boredazfcuk
Copy link
Owner

Ahh yeah, I see what's happening. I sanitise the name of the cookie file, so that I know the filename when I check it's existence, it's validity period and such.

When I run the Python script to create the cookie, I pass the apple_id as it is specified in the variables file. The download script, then creates the cookie file respecting any capitalisations.

I've changed the sanitisation rule to two rules now:

   apple_id="$(echo -n "${apple_id}" | tr '[:upper:]' '[:lower:]')"
   cookie_file="$(echo -n "${apple_id//[^a-z0-9_]/}")"

The first rule changes the apple_id variable used throughout the script, to lower case.
The second takes the already lower case apple_id and removes anything that isn't a lower case letter, number or underscore.

Just building a new image on my machines at home and will probably upload the new version to Dockerhub in the morning as it's past midnight here. My automated builds script takes a couple of hours to run and I'm not sitting up waiting for it lol

Thanks for reporting the issue.

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

No branches or pull requests

2 participants