# how can ai agents handle 2FA? An agent may have the right password and still fail when a website sends an email code, asks for a TOTP or starts a passkey sign-in. Each method needs a different security boundary. AI agents can handle 2FA by reading an approved service-specific inbox, requesting a current TOTP code, or asking the user’s phone to sign a passkey sign-in, which the user allows each time. ## email codes should not require the whole inbox Connecting Gmail can expose years of unrelated messages, password resets and personal history. A service-specific inbox narrows the data available to the agent and makes it clear which account the code belongs to. Decoy can create a separate address for a service, receive its messages and release approved message content to the agent. The agent can retrieve the code without receiving access to the user’s primary mailbox. ## TOTP should release a code, not the seed A TOTP seed is a reusable secret. Once copied, it can generate future codes. The safer interface generates the current short-lived code and returns only that result. Decoy stores the TOTP material with the account and can release a current code within approved access. The agent does not need the reusable seed. ## passkeys are signed, not revealed A passkey sign-in begins with a challenge from the website. The person’s phone signs that challenge and returns an assertion; the private key never leaves the phone. Decoy asks the person for every passkey sign-in an agent makes: they allow it once on their phone, with Face ID. Nothing standing is granted, and agents never add or remove passkeys. ## denials and timeouts are part of the API An authenticated workflow should not fail silently when the user denies access or the phone is unavailable. The agent needs a clear response so it can pause, explain what it needs or take another path. ## Questions ### does an agent need access to Gmail for email 2FA? No. A service-specific Decoy inbox can receive the code without exposing the user’s primary Gmail account. ### does the agent receive the TOTP seed? No. It receives a current TOTP code within the access the user approved. ### can an agent use my passkeys? Only per use: the agent asks, and you allow that one sign-in on your phone. The private key never leaves the phone. ## Related - [AI authentication logic: how agents connect and sign in](https://www.decoys.me/guides/ai-agent-authentication.md) - [how should passkeys work for ai agents?](https://www.decoys.me/guides/passkeys-for-ai-agents.md) - [how can you give an ai agent email access safely?](https://www.decoys.me/guides/ai-agent-email-access.md)