Multi-Factor Authentication
Add an additional layer of security to your application.
Multi-Factor Authentication (MFA) is an additional method of securing your application. MFA adds a layer of security during sign in that requires a user to provide an additional time-based one-time password (TOTP).
Hosted AuthKit’s built-in MFA uses authenticator-app codes (TOTP), not SMS. For SMS-based MFA, use the standalone MFA API, which supports US phone numbers only. This is a separate integration: your application manages factor enrollment, challenges, and verification rather than AuthKit handling the flow automatically.
AuthKit will make the necessary API calls to handle first-time configuration of users’ MFA factors automatically, and validate one-time codes as part of the authentication flow.
In the WorkOS Dashboard, open Authentication → Features and select Enable on the Multi-factor auth card. In the dialog, select Required, then select Save changes. For password, email-code, and social OAuth sign-ins, new and existing users must set up an authenticator app and verify a one-time passcode before authentication completes. A user-verified passkey satisfies the MFA requirement without a separate TOTP challenge.


AuthKit does not expose a built-in claim or session field that tells your backend that a specific session (sid) completed MFA:
- AuthKit access tokens do not include built-in
amr(authentication methods),acr(authentication assurance), or MFA-completion claims. - The SDK
Sessionobject has no MFA-completion field. ItsauthMethoddescribes how the session was initiated, not whether a second factor was verified. Session status and timestamps are not MFA evidence either. - WorkOS Connect ID tokens do not include
amr,acr, orauth_time. Do not apply AuthKit access-token claims to Connect ID tokens.
The auth_time claim in an AuthKit access token records the user’s most recent active authentication, not which factors were used. Refreshing tokens does not advance it. Neither auth_time, iat, nor an enrolled factor proves that a particular session completed TOTP. Adding a static custom claim does not provide that proof.
With MFA set to Required, AuthKit enforces TOTP verification before completing a new password, email-code, or social OAuth sign-in. For these flows, successful authentication means the requirement was satisfied. With Hosted AuthKit, this means a successful server-side authorization-code exchange and normal session-token validation, not simply reaching your callback URL.
Keep these limits in mind:
- Passkeys: User verification satisfies the MFA requirement without a separate TOTP code.
- SSO: AuthKit’s Required MFA setting does not apply to SSO users. Enforce the appropriate policy at the identity provider; successful SSO alone does not identify the factors it used.
- Other session sources: Do not extend this sign-in guarantee to imported or impersonated sessions, or authentication delegated to your own system.
- Existing sessions and refresh: Enabling Required MFA is not proof about an existing session. Token refresh does not perform another MFA challenge.
This enforcement guarantee is not a session-bound record of the factor used or its verification time.
If your backend must explicitly verify TOTP completion for a session, capture the verification in a flow your backend controls:
- Use a custom sign-in UI. Integrate the AuthKit MFA API and Authenticate with TOTP. Track the successful TOTP step through any remaining authentication requirements, then associate it with the resulting authenticated user and session.
- Keep Hosted AuthKit and add a TOTP challenge. From your backend, list the authenticated user’s factors, select their TOTP factor, create a challenge, and verify the code, requiring
valid: true. You can reuse the factor enrolled through Hosted AuthKit, but must request a fresh, unused code. This proves the new challenge, not the earlier hosted challenge, and does not add an MFA claim to the JWT.
Bind the challenge and your short-lived verification record to the environment, authenticated user, session ID, organization when applicable, and factor ID. Derive session identifiers from a validated token, not client-supplied values. Enforce an attempt deadline and record verification server-side before granting protected access. Deny access when the record is missing or expired, and invalidate it when the session ends or the factor is reset.
If you’d prefer to build and manage your own authentication UI, you can do so via the AuthKit Multi-Factor API.
Examples of building custom UI are also available on GitHub.