Treating 'iTunes Store Sign-in required' the same way as expired pass#432
Treating 'iTunes Store Sign-in required' the same way as expired pass#432
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds automatic re-login handling for iTunes Store sign-in required errors (code 2042), treating them the same way as expired password token errors (code 2034). When ipatool hasn't been used for several days, the iTunes Store returns error code 2042 requiring sign-in. The tool previously only auto-relogged for error code 2034, failing on 2042 errors.
Changes:
- Added new constant
FailureTypeSignInRequired = "2042"to handle sign-in required errors - Updated error handling in four API methods (Purchase, Download, ListVersions, GetVersionMetadata) to trigger auto-login for both error codes
- Added fork-specific build script and version identifier
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/appstore/constants.go | Added FailureTypeSignInRequired constant for error code 2042 |
| pkg/appstore/appstore_purchase.go | Updated condition to handle FailureTypeSignInRequired alongside FailureTypePasswordTokenExpired |
| pkg/appstore/appstore_download.go | Updated condition to handle FailureTypeSignInRequired alongside FailureTypePasswordTokenExpired |
| pkg/appstore/appstore_list_versions.go | Updated condition to handle FailureTypeSignInRequired alongside FailureTypePasswordTokenExpired |
| pkg/appstore/appstore_get_version_metadata.go | Updated condition to handle FailureTypeSignInRequired alongside FailureTypePasswordTokenExpired |
| generate_release.sh | New build script with fork-specific naming (eve-ipatool) |
| cmd/root.go | Updated version string to fork-specific identifier "3.0.0-eve-fix-2042" |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (res.Data.FailureType == FailureTypePasswordTokenExpired || | ||
| res.Data.FailureType == FailureTypeSignInRequired) { |
There was a problem hiding this comment.
Test coverage is missing for the new FailureTypeSignInRequired error handling. The existing test suite has a "When password token is expired" test case at line 100-119 that tests FailureTypePasswordTokenExpired. A similar test case should be added for FailureTypeSignInRequired to ensure this new failure type is properly handled and returns ErrPasswordTokenExpired as expected.
| if (res.Data.FailureType == FailureTypePasswordTokenExpired || | ||
| res.Data.FailureType == FailureTypeSignInRequired) { |
There was a problem hiding this comment.
Test coverage is missing for the new FailureTypeSignInRequired error handling. The existing test suite has a "When password token is expired" test case at line 65-84 that tests FailureTypePasswordTokenExpired. A similar test case should be added for FailureTypeSignInRequired to ensure this new failure type is properly handled and returns ErrPasswordTokenExpired as expected.
| if (res.Data.FailureType == FailureTypePasswordTokenExpired || | ||
| res.Data.FailureType == FailureTypeSignInRequired) { |
There was a problem hiding this comment.
Test coverage is missing for the new FailureTypeSignInRequired error handling. The existing test suite has a "When password token is expired" test case at line 68-87 that tests FailureTypePasswordTokenExpired. A similar test case should be added for FailureTypeSignInRequired to ensure this new failure type is properly handled and returns ErrPasswordTokenExpired as expected.
| @@ -0,0 +1 @@ | |||
| git archive --format=tar.gz HEAD -o eve-ipatool-3.0.0.tar.gz | |||
There was a problem hiding this comment.
The new file 'generate_release.sh' appears to be project-specific (contains "eve-ipatool-3.0.0") and may not be intended for the upstream repository. This script seems related to creating a release artifact for a fork or custom version. Consider whether this file should be included in this pull request or if it should be in a separate configuration or kept locally.
| git archive --format=tar.gz HEAD -o eve-ipatool-3.0.0.tar.gz | |
| PROJECT_NAME=$(basename "$(pwd)") | |
| VERSION_TAG=$(git describe --tags --always 2>/dev/null || echo "snapshot") | |
| git archive --format=tar.gz HEAD -o "${PROJECT_NAME}-${VERSION_TAG}.tar.gz" |
| ) | ||
|
|
||
| var version = "dev" | ||
| var version = "3.0.0-eve-fix-2042" |
There was a problem hiding this comment.
The version string "3.0.0-eve-fix-2042" appears to be specific to a fork or custom version ("eve"). This may not be appropriate for the main repository. Consider using a more generic version identifier or removing this change if this PR is intended for the upstream repository.
| var version = "3.0.0-eve-fix-2042" | |
| var version = "3.0.0" |
| if (res.Data.FailureType == FailureTypePasswordTokenExpired || | ||
| res.Data.FailureType == FailureTypeSignInRequired) { |
There was a problem hiding this comment.
Test coverage is missing for the new FailureTypeSignInRequired error handling. The existing test suite has a "When password token is expired" test case at line 96-119 that tests FailureTypePasswordTokenExpired. A similar test case should be added for FailureTypeSignInRequired to ensure this new failure type is properly handled and returns ErrPasswordTokenExpired as expected.
…word token (with automatic re-login)
In case the ipatool hadn't been used for some days, upon a bundle download attempt it returns an error
Sign In to the iTunes Storewith error code2042.The tool currently attempts to re-login automatically only if the
2034(FailureTypePasswordTokenExpired) code is returned, but for the error 2042 it just fails.This PR adds handling of the
2042error to the tool similar to how2034is handled.Such auto-login doesn't require 2FA.