appstore: Fix/invalid auth code
This pull request improves error handling for App Store login, specifically around two-factor authentication (2FA) codes. It introduces a new error for invalid or expired 2FA codes, enhances the logic for parsing login responses, and adds comprehensive test coverage for these scenarios.
Error handling improvements:
- Added a new error
ErrInvalidAuthCodeto represent invalid or expired 2FA codes inappstore_login.go. - Updated the login response parser to return
ErrInvalidAuthCodefor various failure types and customer messages related to invalid 2FA codes. - Included the
FailureTypeInvalidAuthCodeconstant ("5005") to identify invalid auth code errors from the API. - Improved generic error reporting by including the failure type in error messages for easier debugging.
Test coverage enhancements:
- Added new tests to ensure that invalid or expired 2FA codes return the correct error, and that error messages include the failure type when appropriate. [1] [2] [3]
fixing #392 and #387
need to reference @pradeepvizz for suggesting one request a 2FA code on the website and then utilizing that through the auth-code parameter.
hi, could you tell how can I use this tool? I try to build binary exe file and run
✦3 ❯ ./ipatool auth login -e [email protected] -p xxxxxxxxx --verbose
[4] 18822
zsh: command not found: 8c
ipatool on fix/invalid-auth-code [?] via 🐹 v1.24.1
✦4 ❯ 8:05AM INF enter 2FA code:
[4] + suspended (tty input) ./ipatool auth login -e [email protected] -p xxxxxxxxx
but the process was already terminated before I had a chance to enter the 2FA code.
hi, could you tell how can I use this tool? I try to build binary exe file and run
✦3 ❯ ./ipatool auth login -e [email protected] -p xxxxxxxxx --verbose [4] 18822 zsh: command not found: 8c ipatool on fix/invalid-auth-code [?] via 🐹 v1.24.1 ✦4 ❯ 8:05AM INF enter 2FA code: [4] + suspended (tty input) ./ipatool auth login -e [email protected] -p xxxxxxxxxbut the process was already terminated before I had a chance to enter the 2FA code.
you need to escape like wrap your email in double quotes it looks like "[email protected]" and also you need to request a 2fa code from the official apple site when you login and use that 2fa code when you're trying to login
hi, could you tell how can I use this tool? I try to build binary exe file and run
✦3 ❯ ./ipatool auth login -e [email protected] -p xxxxxxxxx --verbose [4] 18822 zsh: command not found: 8c ipatool on fix/invalid-auth-code [?] via 🐹 v1.24.1 ✦4 ❯ 8:05AM INF enter 2FA code: [4] + suspended (tty input) ./ipatool auth login -e [email protected] -p xxxxxxxxxbut the process was already terminated before I had a chance to enter the 2FA code.
you need to escape like wrap your email in double quotes it looks like "[email protected]" and also you need to request a 2fa code from the official apple site when you login and use that 2fa code when you're trying to login
thanks for your help, I login successfully