Team Commsvendor:discordEmail OTPUnwrapped Magic LinkCarrier SMS DIDCloud KMS TOTP

Automate Discord New Login Location & 2FA in Playwright & Stagehand

Automate Discord New Login Location IP-authorization links (unwrapped from SendGrid trackers), email codes, SMS OTPs, and TOTP.

Curated Stage 4 Extractor Profile (vendor:discord)

Extracts 6-digit Discord security codes, unwraps `click.discord.com/ls/click` SendGrid wrappers around `/authorize-ip` and `/verify` magic links, and ignores Nitro receipts and missed message digests.

Matched Sender Domains
discord.comdiscordapp.com
Login URL example: https://discord.com/login
Filtered Non-Auth Noise
  • Missed messages & server digest emails
  • Discord Nitro billing receipts

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

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

# Paste into Gmail -> Settings -> Filters -> Create a new filter ("Has the words")
from:(discord.com OR discordapp.com) ("New Login Location" OR "Authorize IP" OR "security code" OR "verification code")

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

2. Copy-Paste Discord 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('Discord cloud login with New Login Location IP approval + TOTP', async ({ page }) => {
  await page.goto('https://discord.com/login');
  await page.fill('input[name="email"]', process.env.DISCORD_EMAIL!);
  await page.fill('input[name="password"]', process.env.DISCORD_PASSWORD!);
  await page.click('button[type="submit"]');

  // Discord blocks cloud IPs with "New Login Location Detected" email
  const ipWarning = page.locator('text=New login location detected');
  if (await ipWarning.isVisible({ timeout: 5000 }).catch(() => false)) {
    const auth = await relay.wait('discord-bot', { sender: 'discord', timeout: 30 });
    if (auth.event?.magicLink) {
      await page.goto(auth.event.magicLink);
      await page.click('button:has-text("Authorize IP")');
      await page.goto('https://discord.com/login');
    }
  }

  // Handle Discord Authenticator TOTP if enabled
  const mfaInput = page.locator('input[placeholder*="6-digit"]');
  if (await mfaInput.isVisible({ timeout: 4000 }).catch(() => false)) {
    const token = await relay.totp.get('discord-bot', 'discord_totp');
    await mfaInput.fill(token.code);
    await page.click('button[type="submit"]');
  }

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

3. Discord Production Gotchas

Frequently Asked Questions

Does Sentry Relay unwrap Discord SendGrid click-tracker links?
Yes. Stage 3 unwraps click.discord.com/ls/click links and Stage 4 extracts the verified Discord authorization URL.
Can Sentry Relay handle both Discord IP verification AND 2FA TOTP in one login?
Yes. Call relay.wait() for the IP authorization email and relay.totp.get() for the Discord Authenticator token on the same Identity.
Will missed-message digests break the poller?
No. Missed messages, server digests, and Nitro receipts are disqualified automatically.
Provision an Isolated Identity for Discord

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).