A Next.js application that automates ESPN login and extracts authentication cookies (SWID and espn_s2) using Puppeteer.
- Automated ESPN login flow using Puppeteer headless browser
- OTP-based email verification
- Automatic cookie extraction (SWID and espn_s2)
- Debug screenshot gallery for troubleshooting
- Session management with automatic cleanup
- Full logging and debugging capabilities
- Node.js 16+
- npm or yarn
- Valid ESPN account with email access
npm installnpm run devOpen http://localhost:3000 in your browser.
npm run build
npm start- Navigate to the homepage
- Enter your ESPN email address
- Click "Send OTP"
- Check your email for the OTP code
- Enter the 6-digit OTP on the page
- Click "Verify OTP"
- The extracted SWID and ESPN S2 cookies will be displayed
- Automated Browser Control: Uses Puppeteer to automate the ESPN login process
- Debug Screenshots: Captures screenshots at each step for troubleshooting
- Session Management: Maintains browser sessions with automatic 30-minute timeout
- OTP Verification: Handles multi-step OTP verification
- Logging: Comprehensive logging for debugging
Start Login
{
"action": "start",
"email": "user@example.com"
}Verify OTP
{
"action": "verify",
"otp": "123456"
}Headers:
x-session-id: Session ID from start response
- Screenshots not loading: Check the
/public/debugdirectory - Session expired: Sessions expire after 30 minutes of inactivity
- OTP not received: Check spam folder and verify email address
- Browser timeout: May occur with slow internet, increase timeout values in
route.ts
- Cookies are extracted client-side and never stored on the server
- Sessions are automatically cleaned up after 30 minutes
- The application uses headless Chromium for security
- Avoid running this in shared environments