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

fix: fallback to old raw password auth if srp auth fails #1018

Merged
merged 1 commit into from
Dec 27, 2024

Conversation

iowk
Copy link
Contributor

@iowk iowk commented Dec 9, 2024

As mentioned by @gcobb321 #975 (comment), Apple seems to be rolling back to the old non-SRP authentication for some accounts.

This PR creates a flow to fallback to the old authentication when SRP authentication fails.

I have an account that failed to login with SRP, and is fixed with this PR.

msg = "Invalid email/password combination."
raise PyiCloudFailedLoginException(msg, error) from error
self._authenticate_srp()
except PyiCloudFailedLoginException as error:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there is anything in payload we can use as a flag for srp rather than try-catch.

If try-catch is the only way, what other exceptions may be incorrectly channelled to non-srp path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the account I tried, the response for srp signin/complete is:

('Invalid email/password combination.', PyiCloudAPIResponseException('{\n  "serviceErrors" : [ {\n    "code" : "-20283",\n    "message" : "Enter the email or phone number and password for your Apple\xa0Account.",\n    "suppressDismissal" : false\n  } ]\n} (401)'))

Which is the same as when the password is incorrect.

This also means if the password is incorrect, it will be incorrectly channelled to non-srp path.

@AndreyNikiforov AndreyNikiforov merged commit b700382 into icloud-photos-downloader:master Dec 27, 2024
372 checks passed
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

Successfully merging this pull request may close these issues.

2 participants