Skip to content

Treating 'iTunes Store Sign-in required' the same way as expired pass#432

Open
gitevedev wants to merge 2 commits intomajd:mainfrom
gitevedev:reauth
Open

Treating 'iTunes Store Sign-in required' the same way as expired pass#432
gitevedev wants to merge 2 commits intomajd:mainfrom
gitevedev:reauth

Conversation

@gitevedev
Copy link

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 Store with error code 2042.

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 2042 error to the tool similar to how 2034 is handled.
Such auto-login doesn't require 2FA.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +49 to +50
if (res.Data.FailureType == FailureTypePasswordTokenExpired ||
res.Data.FailureType == FailureTypeSignInRequired) {
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +37
if (res.Data.FailureType == FailureTypePasswordTokenExpired ||
res.Data.FailureType == FailureTypeSignInRequired) {
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +38 to +39
if (res.Data.FailureType == FailureTypePasswordTokenExpired ||
res.Data.FailureType == FailureTypeSignInRequired) {
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1 @@
git archive --format=tar.gz HEAD -o eve-ipatool-3.0.0.tar.gz
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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"

Copilot uses AI. Check for mistakes.
)

var version = "dev"
var version = "3.0.0-eve-fix-2042"
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
var version = "3.0.0-eve-fix-2042"
var version = "3.0.0"

Copilot uses AI. Check for mistakes.
Comment on lines +75 to +76
if (res.Data.FailureType == FailureTypePasswordTokenExpired ||
res.Data.FailureType == FailureTypeSignInRequired) {
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
gitevedev and others added 2 commits February 27, 2026 12:24
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