You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Prompt the user to enter their TOTP code (from their authenticator app)
87
+
// Hardcoded for now, but in a real app you'd get this from the user
88
+
const totpCode ="123456";
89
+
const multiFactorId ="123456"; // This is the multiFactorId from the first step
90
+
91
+
// Step 2: Submit the TOTP code with multiFactorId to complete the flow
92
+
const handleMfaSubmission = (email:string) => {
76
93
authenticate(
77
94
{
78
95
type: "email",
79
96
emailMode: "magicLink",
80
-
email: mfaData.email,
97
+
email,
81
98
// The multiFactors array tells the authentication system which
82
99
// factor to verify and what code to use
83
100
multiFactors: [
84
101
{
85
-
multiFactorId: mfaData.multiFactorId,
102
+
multiFactorId,
86
103
multiFactorCode: totpCode,
87
104
},
88
105
],
@@ -102,44 +119,46 @@ function MagicLinkWithMFA() {
102
119
}
103
120
```
104
121
105
-
### Step 2: Handle the Magic Link Redirect
122
+
### Step 3: Handle the Magic Link Redirect
106
123
107
-
When the user clicks the magic link in their email, your application needs to handle the redirect and complete the authentication:
124
+
When the user clicks the magic link in their email, your application needs to handle the redirect and complete the authentication.
125
+
The magic link will redirect to your application with a bundle parameter. You must submit this bundle to the `authenticate` function to complete the authentication.
Copy file name to clipboardExpand all lines: site/pages/react/mfa/setup-mfa.mdx
-5Lines changed: 0 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,17 +13,12 @@ By requiring both a user's primary login (e.g., email OTP, magic link, or social
13
13
Multi-factor authentication requires a primary authentication method (Email OTP, Email Magic Link, or Social Login) to be already set up. See the [React Quickstart](/react/quickstart) guide to set up your primary authentication method first.
14
14
:::
15
15
16
-
## Overview
17
-
18
-
Multi-factor authentication adds an extra layer of security by requiring users to verify their identity using multiple methods. With Account Kit, users can use authenticator apps (like Google Authenticator, Authy, or Microsoft Authenticator) as their second security factor.
19
-
20
16
## Prerequisites
21
17
22
18
Before implementing MFA, you need to have:
23
19
24
20
1.**Set up primary authentication** - MFA requires a primary authentication method to be already set up. Follow the [React Quickstart](/react/quickstart) guide to configure email (OTP or magic link) or social login.
25
21
2.**Working authentication flow** - Ensure users can successfully sign in with your primary authentication method.
26
-
3.**Proper configuration** - In your `config.ts`, make sure you've enabled email or social login in the authentication sections.
27
22
28
23
:::info
29
24
MFA is an additional security layer that works with your existing authentication system. If you haven't set up basic authentication yet, you won't be able to implement MFA.
0 commit comments