From db7cf88c1b1c4303224d3d17ff0f556a54b7dbc3 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Thu, 29 Dec 2022 14:55:04 +0100 Subject: [PATCH] eg: don't await MFA --- epic-games.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/epic-games.js b/epic-games.js index 6c526b8..edab185 100644 --- a/epic-games.js +++ b/epic-games.js @@ -87,13 +87,13 @@ try { page.waitForSelector('#h_captcha_challenge_login_prod iframe').then(() => { console.log('Got a captcha! You may have to solve it in the browser if the NopeCHA extension fails to do so.'); }); - // TODO alternatively wait for redirectUrl - await page.waitForNavigation({ url: '**/id/login/mfa**'}).then(async () => { + // handle MFA, but don't await it + page.waitForNavigation({ url: '**/id/login/mfa**'}).then(async () => { console.log('Enter the security code to continue - This appears to be a new device, browser or location. A security code has been sent to your email address at ...'); - const otp = await prompt({type: 'number', message: 'Enter two-factor sign in code', validate: n => n.toString().length == 6 || 'The code must be 6 digits!'}); + const otp = await prompt({type: 'text', message: 'Enter two-factor sign in code', validate: n => n.toString().length == 6 || 'The code must be 6 digits!'}); // can't use type: 'number' since it strips away leading zeros and codes sometimes have them await page.type('input[name="code-input-0"]', otp.toString()); await page.click('button[type="submit"]'); - }); + }).catch(_ => { }); } else { console.log('Waiting for you to login in the browser.'); }