diff --git a/epic-claimer-new.js b/epic-claimer-new.js index c4335af..8d81e14 100644 --- a/epic-claimer-new.js +++ b/epic-claimer-new.js @@ -14,6 +14,7 @@ import { handleSIGINT, } from './src/util.js'; import { cfg } from './src/config.js'; +import { getDeviceAuths, setAccountAuth } from './src/device-auths.js'; const URL_CLAIM = 'https://store.epicgames.com/en-US/free-games'; @@ -329,12 +330,26 @@ export const claimEpicGamesNew = async () => { const page = context.pages().length ? context.pages()[0] : await context.newPage(); await page.setViewportSize({ width: cfg.width, height: cfg.height }); + // Use device auths if available (from legacy mode) + const deviceAuths = await getDeviceAuths(); + if (deviceAuths && cfg.eg_email) { + const accountAuth = deviceAuths[cfg.eg_email]; + if (accountAuth) { + console.log('🔄 Reusing device auth from legacy mode'); + const cookies = [ + { name: 'EPIC_SSO_RM', value: accountAuth.deviceAuth?.refreshToken || '', domain: '.epicgames.com', path: '/' }, + { name: 'EPIC_DEVICE', value: accountAuth.deviceAuth?.deviceId || '', domain: '.epicgames.com', path: '/' }, + { name: 'EPIC_SESSION_AP', value: accountAuth.deviceAuth?.accountId || '', domain: '.epicgames.com', path: '/' }, + ]; + await context.addCookies(cookies); + console.log('✅ Device auth cookies loaded'); + } + } + let user; try { const auth = await getValidAuth({ - email: cfg.eg_email, - password: cfg.eg_password, otpKey: cfg.eg_otpkey, reuseCookies: true, cookiesPath: COOKIES_PATH,