Identity & SSOvendor:oktaEmail OTPUnwrapped Magic LinkCarrier SMS DIDCloud KMS TOTP
Automate Okta OTP, SMS 2FA & TOTP in Browser Use, Playwright & Stagehand
Automate Okta Verify TOTP, Email OTP passcodes, activation magic links, and SMS 2FA for enterprise SSO portal agents.
1. 60-Second Gmail & Outlook Auto-Forwarding Filter
Don't want to change your existing account email on Okta? Keep your corporate inbox on Okta and forward only verification emails to <identity-slug>@in.sentryrelay.com. Sentry Relay's Stage 2 unwrapper preserves the original Okta sender header automatically (full setup guide).
# Paste into Gmail -> Settings -> Filters -> Create a new filter ("Has the words")
from:(okta.com OR oktapreview.com) ("verification code" OR "passcode" OR "one-time" OR "verify your identity")
# Action: Forward it to -> <your-identity-slug>@in.sentryrelay.com2. Copy-Paste Okta 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('Okta SSO login with Email OTP or Okta TOTP', async ({ page }) => {
await page.goto('https://your-org.okta.com/');
await page.fill('input[name="identifier"]', process.env.OKTA_USERNAME!);
await page.click('input[type="submit"], button[type="submit"]');
await page.fill('input[name="credentials.passcode"]', process.env.OKTA_PASSWORD!);
await page.click('input[type="submit"], button[type="submit"]');
// Option A: Okta Email OTP challenge
const auth = await relay.wait('okta-sso-bot', {
sender: 'okta',
timeout: 30,
});
if (auth.event?.otpCode) {
await page.fill('input[name="credentials.passcode"]', auth.event.otpCode);
await page.click('input[type="submit"], button[type="submit"]');
}
await expect(page).toHaveURL(/okta\.com\/app/);
});3. Okta Production Gotchas
Enroll Standard TOTP Alongside Okta Verify Push
Okta Verify Push requires a human smartphone tap. In Okta Security Settings, enroll Google Authenticator / TOTP or Email/SMS factor on your service identity so headless agents never wait on push prompts.
Both okta.com and oktapreview.com Supported
Testing against an Okta staging tenant on `oktapreview.com`? Passing `sender: "okta"` matches both production and preview domains automatically.
Strict Client Isolation for Enterprise Tenants
B2B agencies logging into multiple clients' Okta SSO tenants can issue one `scopedIdentityIds` API key per client so workers remain cryptographically isolated.