Identity & SSOvendor:googleEmail OTPUnwrapped Magic LinkCarrier SMS DIDCloud KMS TOTP
Automate Google 2FA, G-Codes & Gmail Forwarding Verification in Playwright
Normalize G-XXXXXX Google verification codes, handle 9-digit Gmail Forwarding Confirmations, and unblock Google Workspace logins in headless browsers.
1. 60-Second Gmail & Outlook Auto-Forwarding Filter
Don't want to change your existing account email on Google & Workspace? Keep your corporate inbox on Google & Workspace and forward only verification emails to <identity-slug>@in.sentryrelay.com. Sentry Relay's Stage 2 unwrapper preserves the original Google & Workspace sender header automatically (full setup guide).
# Paste into Gmail -> Settings -> Filters -> Create a new filter ("Has the words")
from:(google.com OR accounts.google.com) ("verification code" OR "security code" OR "G-" OR "Gmail Forwarding Confirmation")
# Action: Forward it to -> <your-identity-slug>@in.sentryrelay.com2. Copy-Paste Google & Workspace 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 } from '@playwright/test';
import { SentryRelay } from '@sentryrelay/sdk';
const relay = new SentryRelay({ apiKey: process.env.SENTRY_RELAY_API_KEY! });
test('Resolve Google SMS G-code or TOTP during cloud sign-in', async ({ page }) => {
await page.goto('https://accounts.google.com/');
await page.fill('input[type="email"]', process.env.GOOGLE_BOT_EMAIL!);
await page.click('#identifierNext button');
await page.waitForSelector('input[type="password"]');
await page.fill('input[type="password"]', process.env.GOOGLE_BOT_PASSWORD!);
await page.click('#passwordNext button');
// Wait for Google SMS G-XXXXXX code (automatically normalized to 6 digits)
const auth = await relay.wait('google-bot', {
channel: 'sms',
sender: 'google.com',
timeout: 35,
});
await page.fill('input[type="tel"], input#idvPin', auth.event!.otpCode!);
await page.click('#idvPreregisteredPhoneNext button, #totpNext button');
});3. Google & Workspace Production Gotchas
Stripping Google's "G-" SMS Prefix Automatically
Google SMS texts look like `G-849201 is your Google verification code`, but the Google login input expects only `849201`. Stage 4 normalizes `G-` prefixes automatically so you never paste `G-` into numeric inputs.
60-Second Gmail Auto-Forward Confirmation
When linking a client Gmail inbox to Sentry Relay, Google sends a 9-digit confirmation code and a `mail-settings.google.com/mail/vf-...` link. Sentry Relay auto-extracts both and mirrors the confirmation to your Human-Fallback email.
Datacenter IP Phone Prompts
Google aggressively flags datacenter IPs with SMS verification instead of TOTP. Attach a dedicated US carrier Telnyx DID (not VoIP) to your Identity so Google accepts the verification number.