Framework guide
Handle 2FA and OTP codes in Puppeteer automatically
Fetch the code and type it into the 2FA input in your Puppeteer script. OTPilot keeps the TOTP seed encrypted on its side; your Puppeteer agent only ever receives the current code, its expiry and the next code.
Puppeteer · javascript
// Log into Shopify with Puppeteer + OTPilot
const res = await fetch("https://otpilot.vibiz.app/api/v1/codes/shopify", {
headers: { Authorization: `Bearer ${process.env.OTPILOT_KEY}` },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.message} Fix: ${data.error.fix}`);
await page.type('input[autocomplete="one-time-code"], input[name*="otp" i], input[name*="code" i]', data.code);
await page.keyboard.press("Enter");Why not put the seed in your Puppeteer code?
- · A seed in an env var or prompt can generate codes forever — anyone who reads your logs, traces or repo can log in.
- · With OTPilot the agent holds a revocable, rate-limited key scoped to specific accounts. Revoke it and access ends instantly.
- · Each fetch is logged with the reason the agent gave, and sensitive accounts can require a human tap.
Puppeteer 2FA guides by site
- Amazon 2FA with Puppeteer→
- Amazon Web Services 2FA with Puppeteer→
- Cloudflare 2FA with Puppeteer→
- DigitalOcean 2FA with Puppeteer→
- GitHub 2FA with Puppeteer→
- GitLab 2FA with Puppeteer→
- HubSpot 2FA with Puppeteer→
- Microsoft Azure 2FA with Puppeteer→
- PayPal 2FA with Puppeteer→
- Shopify 2FA with Puppeteer→
- Slack 2FA with Puppeteer→
- Stripe 2FA with Puppeteer→
Try it with your own secret — no signup
Paste a TOTP secret on the home page and get a live code plus a working API call in seconds.