Sign users in with a one-time code that Auth emails to them
When the signIn function from the useSignIn hook sends an email address with the email_verification_code option, Auth emails a one-time code to that address. Once the hook returns the needs_verification status, the sample passes the code that the user types to attemptVerification. If the account also requires a second factor, the status changes to needs_mfa while mfaMethod holds the factor that Auth asks for. When that factor is totp, the sample sends the code from the user's authenticator app with attemptMfa.
Impact
When the status reaches complete, the sign-in page redirects the user to /dashboard. On each request to /dashboard, the conjoinProxy handler in the sample verifies the session cookie on your server before it redirects any visitor without a valid session to /sign-in.
Prompt for a coding agent: Let users sign in with a code that we email them, and ask accounts with MFA for an authenticator code.
Select a file to view its contents