From 21cbd596bcbae752df0832fb09bb1f43f2e1eec5 Mon Sep 17 00:00:00 2001 From: Max <1824153+tux-mind@users.noreply.github.com> Date: Mon, 20 Jan 2025 00:13:19 +0100 Subject: [PATCH] Fix initial authentication attempt with 2FA (#331) I though that the first attempt would not contain the 2fa code, but I was wrong. This fixes the authentication when using 2fa enabled accounts. closes majd/ipatool#326 Co-authored-by: Majd Alfhaily --- pkg/appstore/appstore_login.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pkg/appstore/appstore_login.go b/pkg/appstore/appstore_login.go index 86db009b..32f22845 100644 --- a/pkg/appstore/appstore_login.go +++ b/pkg/appstore/appstore_login.go @@ -73,12 +73,7 @@ func (t *appstore) login(email, password, authCode, guid string) (Account, error retry := true for attempt := 1; retry && attempt <= 4; attempt++ { - ac := authCode - if attempt == 1 { - ac = "" - } - - request := t.loginRequest(email, password, ac, guid, attempt) + request := t.loginRequest(email, password, authCode, guid, attempt) request.URL, _ = util.IfEmpty(redirect, request.URL), "" res, err = t.loginClient.Send(request)