fix: reauth error catch

This commit is contained in:
Esonhugh
2026-04-28 02:14:19 +08:00
parent a31181ea95
commit 34be882f88
2 changed files with 1188 additions and 1 deletions

View File

@@ -581,7 +581,17 @@ export async function loginAppleDeveloperAccount(request: AppleDeveloperLoginReq
api = fresh.api;
const { getAnisetteData } = await import('./anisette-service');
const freshAnisette = await getAnisetteData();
({ session } = await api.authenticate(appleId, password, freshAnisette, verificationCallback));
try {
({ session } = await api.authenticate(appleId, password, freshAnisette, verificationCallback));
} catch (reauth2) {
// If the fresh SRP exchange also hits the apptokens 2FA gate (rare),
// REAUTH_SENTINEL escapes here. Surface it as a human-readable error
// instead of exposing the internal sentinel string.
if (reauth2 instanceof Error && reauth2.message === REAUTH_SENTINEL) {
throw new Error('Authentication failed after two-factor verification. Please sign in again.');
}
throw reauth2;
}
} else {
throw e;
}

1177
sms-2fa.patch Normal file

File diff suppressed because it is too large Load Diff