Developer & AIvendor:githubEmail OTPUnwrapped Magic LinkCarrier SMS DIDCloud KMS TOTP

Automate GitHub 2FA, Device Verification & TOTP in Playwright & Stagehand

Automate GitHub device verification OTPs, confirm-email magic links, SMS fallback codes, and Cloud KMS TOTP in Playwright, Stagehand, and Browser Use.

Curated Stage 4 Extractor Profile (vendor:github)

Extracts 6–8 digit GitHub device, sudo, and launch verification codes as well as `/sessions/verified-device`, `/login/device`, and `/confirm_verification` magic links while automatically disqualifying noisy PR, issue, commit, Dependabot, and release notification emails.

Matched Sender Domains
github.com
Login URL example: https://github.com/login
Filtered Non-Auth Noise
  • Pull request review & issue #123 notifications
  • Merged PR / commit SHA activity emails
  • Dependabot security alerts & release digests

1. 60-Second Gmail & Outlook Auto-Forwarding Filter

Don't want to change your existing account email on GitHub? Keep your corporate inbox on GitHub and forward only verification emails to <identity-slug>@in.sentryrelay.com. Sentry Relay's Stage 2 unwrapper preserves the original GitHub sender header automatically (full setup guide).

# Paste into Gmail -> Settings -> Filters -> Create a new filter ("Has the words")
from:(noreply@github.com) ("verification code" OR "verify your device" OR "launch code" OR "sudo")

# Action: Forward it to -> <your-identity-slug>@in.sentryrelay.com

2. Copy-Paste GitHub 2FA Automation Snippets

Choose your browser automation stack below. All snippets resolve codes in <200ms with Upstash Redis 15-second lookback protection so arrived-before-wait race conditions never fail a run.

import { test, expect } from '@playwright/test';
import { SentryRelay } from '@sentryrelay/sdk';

const relay = new SentryRelay({ apiKey: process.env.SENTRY_RELAY_API_KEY! });

test('GitHub login with TOTP + new-device Email OTP fallback', async ({ page }) => {
  await page.goto('https://github.com/login');
  await page.fill('input#login_field', process.env.GITHUB_USERNAME!);
  await page.fill('input#password', process.env.GITHUB_PASSWORD!);
  await page.click('input[type="submit"]');

  // Path A: Vaulted RFC 6238 TOTP (auto-waits <=4s if window is expiring)
  const totpInput = page.locator('input#app_totp');
  if (await totpInput.isVisible({ timeout: 4000 }).catch(() => false)) {
    const token = await relay.totp.get('github-runner', 'github_ops');
    await totpInput.fill(token.code);
  }

  // Path B: Unrecognized cloud runner IP triggers GitHub Device Verification
  const deviceInput = page.locator('input#otp');
  if (await deviceInput.isVisible({ timeout: 4000 }).catch(() => false)) {
    const auth = await relay.wait('github-runner', {
      channel: 'email',
      sender: 'github.com',
      timeout: 30,
    });
    if (auth.event?.otpCode) {
      await deviceInput.fill(auth.event.otpCode);
    } else if (auth.event?.magicLink) {
      await page.goto(auth.event.magicLink);
    }
  }

  await expect(page).toHaveURL(/github\.com/);
});

3. GitHub Production Gotchas

Frequently Asked Questions

Can Sentry Relay handle both GitHub TOTP and Email Device Verification together?
Yes. A single Sentry Relay Identity holds both your dedicated @in.sentryrelay.com email inbox (for unrecognized device OTPs and confirm_verification magic links) and your Cloud KMS-encrypted TOTP secret.
Will PR or Dependabot notification emails trigger false positives?
No. The curated vendor:github extractor rule disqualifies pull request, issue, commit, Dependabot, and release notifications so only authentic verification codes and links match.
Do I have to change my GitHub account email to @in.sentryrelay.com?
No. You can keep your existing corporate or Gmail address on GitHub and forward only GitHub verification emails to your Identity via our 60-second Gmail/Outlook filter.
Provision an Isolated Identity for GitHub

Start free in 3 minutes with @in.sentryrelay.com email + Simulated SMS, or attach a dedicated US carrier Telnyx SMS DID starting on Builder ($29/mo) and Growth/Pro ($79/mo).