Skip to content

Commit 1344c76

Browse files
committed
fixes existing code snippets
1 parent bfc7aee commit 1344c76

File tree

14 files changed

+53
-24
lines changed

14 files changed

+53
-24
lines changed

v2/emailpassword/common-customizations/sessions/claims/claim-validators.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ SuperTokens.init({
346346
input.accessTokenPayload = {
347347
...input.accessTokenPayload,
348348
// highlight-next-line
349-
...(await UserRoleClaim.build(input.userId, input.recipeUserId, input.tenantId, input.userContext))
349+
...(await UserRoleClaim.build(input.userId, input.recipeUserId, input.tenantId, undefined, input.userContext))
350350
};
351351

352352
/*

v2/emailpassword/migration/account-creation/ep-migration-without-password-hash.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ EmailPassword.init({
211211
}
212212

213213
// Call the signup function to create a new SuperTokens user.
214-
let signUpResponse = await EmailPassword.signUp(input.email, input.password, input.userContext)
214+
let signUpResponse = await EmailPassword.signUp(input.tenantId, input.email, input.password, undefined, input.userContext)
215215
if (signUpResponse.status !== "OK") {
216216
throw new Error("Should never come here")
217217
}
@@ -229,7 +229,7 @@ EmailPassword.init({
229229

230230
if (generateEmailVerificationTokenResponse.status === "OK") {
231231
// Verify the user's email
232-
await EmailVerification.verifyEmailUsingToken("public", generateEmailVerificationTokenResponse.token, input.userContext);
232+
await EmailVerification.verifyEmailUsingToken("public", generateEmailVerificationTokenResponse.token, undefined, input.userContext);
233233
}
234234
}
235235

@@ -493,7 +493,7 @@ EmailPassword.init({
493493
if (legacyUserInfo) {
494494
// create a SuperTokens account for the user with a temporary password
495495
let tempPassword = await generatePassword();
496-
let signUpResponse = await EmailPassword.signUp(email, tempPassword, input.userContext);
496+
let signUpResponse = await EmailPassword.signUp(input.tenantId, email, tempPassword, undefined, input.userContext);
497497

498498
if (signUpResponse.status === "OK") {
499499

@@ -510,7 +510,7 @@ EmailPassword.init({
510510

511511
if (generateEmailVerificationTokenResponse.status === "OK") {
512512
// verify the user's email
513-
await EmailVerification.verifyEmailUsingToken("public", generateEmailVerificationTokenResponse.token, input.userContext);
513+
await EmailVerification.verifyEmailUsingToken("public", generateEmailVerificationTokenResponse.token, undefined, input.userContext);
514514
}
515515
}
516516

@@ -975,7 +975,7 @@ EmailPassword.init({
975975
}
976976
}
977977
// Call the signup function to create a new SuperTokens user.
978-
let signUpResponse = await EmailPassword.signUp(input.email, input.password, input.userContext)
978+
let signUpResponse = await EmailPassword.signUp(input.tenantId, input.email, input.password, undefined, input.userContext)
979979
if (signUpResponse.status !== "OK") {
980980
throw new Error("Should never come here")
981981
}
@@ -993,7 +993,7 @@ EmailPassword.init({
993993

994994
if (generateEmailVerificationTokenResponse.status === "OK") {
995995
// Verify the user's email
996-
await EmailVerification.verifyEmailUsingToken("public", generateEmailVerificationTokenResponse.token, input.userContext);
996+
await EmailVerification.verifyEmailUsingToken("public", generateEmailVerificationTokenResponse.token, undefined, input.userContext);
997997
}
998998
}
999999

v2/mfa/backend-setup.mdx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,36 @@ hide_title: true
55
---
66

77
import MFAPaidBanner from '../community/reusableMD/mfa/MFAPaidBanner.mdx'
8+
import BackendSDKTabs from "/src/components/tabs/BackendSDKTabs";
89

910
<MFAPaidBanner />
1011

1112
# Backend setup
13+
14+
We start by intialising the MFA recipe on the backend and specifying the list of first factors using their [factor IDs](./important-concepts#auth-factor-ids). You still have to initialise all the auth recipes in the `recipeList`, and configure them based on your needs.
15+
16+
For example, the code below inits `thirdpartyemailpassword` and `passwordless` recipes and sets the `firstFactor` array to be `["emailpassword", "thirdparty"]`. This means that we will show email password and social login to the user as the first factor (using the `thirdpartyemailpassword` recipe), and use `passwordless` for the second factor.
17+
18+
<BackendSDKTabs>
19+
<TabItem value="nodejs">
20+
21+
```ts
22+
TODO
23+
```
24+
25+
</TabItem>
26+
<TabItem value="go">
27+
28+
:::note
29+
Coming soon. In the meantime, checkout the [legacy method](./legacy-method/how-it-works) for adding MFA to your app.
30+
:::
31+
32+
</TabItem>
33+
<TabItem value="python">
34+
35+
:::note
36+
Coming soon. In the meantime, checkout the [legacy method](./legacy-method/how-it-works) for adding MFA to your app.
37+
:::
38+
39+
</TabItem>
40+
</BackendSDKTabs>

v2/mfa/backend/first-factor.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ Session.init({
397397
accessTokenPayload: {
398398
...input.accessTokenPayload,
399399
// highlight-next-line
400-
...(await SecondFactorClaim.build(input.userId, input.recipeUserId, input.tenantId, input.userContext)),
400+
...(await SecondFactorClaim.build(input.userId, input.recipeUserId, input.tenantId, undefined, input.userContext)),
401401
},
402402
});
403403
},

v2/mfa/backend/second-factor.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ Session.init({
686686
...input,
687687
accessTokenPayload: {
688688
...input.accessTokenPayload,
689-
...(await SecondFactorClaim.build(input.userId, input.recipeUserId, input.tenantId, input.userContext)),
689+
...(await SecondFactorClaim.build(input.userId, input.recipeUserId, input.tenantId, undefined, input.userContext)),
690690
},
691691
});
692692
},
@@ -1228,7 +1228,7 @@ Session.init({
12281228
...input,
12291229
accessTokenPayload: {
12301230
...input.accessTokenPayload,
1231-
...(await SecondFactorClaim.build(input.userId, input.recipeUserId, input.tenantId, input.userContext)),
1231+
...(await SecondFactorClaim.build(input.userId, input.recipeUserId, input.tenantId, undefined, input.userContext)),
12321232
// highlight-next-line
12331233
phoneNumber,
12341234
},

v2/passwordless/common-customizations/sessions/claims/claim-validators.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ SuperTokens.init({
346346
input.accessTokenPayload = {
347347
...input.accessTokenPayload,
348348
// highlight-next-line
349-
...(await UserRoleClaim.build(input.userId, input.recipeUserId, input.tenantId, input.userContext))
349+
...(await UserRoleClaim.build(input.userId, input.recipeUserId, input.tenantId, undefined, input.userContext))
350350
};
351351

352352
/*

v2/phonepassword/backend/passwordless-customisation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ supertokens.init({
211211
...input,
212212
accessTokenPayload: {
213213
...input.accessTokenPayload,
214-
...PhoneVerifiedClaim.build(input.userId, input.recipeUserId, input.tenantId, input.userContext),
214+
...PhoneVerifiedClaim.build(input.userId, input.recipeUserId, input.tenantId, undefined, input.userContext),
215215
phoneNumber: userInfo?.emails[0],
216216
},
217217
});

v2/phonepassword/backend/session-customisation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ supertokens.init({
5252
...input,
5353
accessTokenPayload: {
5454
...input.accessTokenPayload,
55-
...PhoneVerifiedClaim.build(input.userId, input.recipeUserId, input.tenantId, input.userContext),
55+
...PhoneVerifiedClaim.build(input.userId, input.recipeUserId, input.tenantId, undefined, input.userContext),
5656
phoneNumber: userInfo?.emails[0],
5757
},
5858
});

v2/session/common-customizations/sessions/claims/claim-validators.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ SuperTokens.init({
346346
input.accessTokenPayload = {
347347
...input.accessTokenPayload,
348348
// highlight-next-line
349-
...(await UserRoleClaim.build(input.userId, input.recipeUserId, input.tenantId, input.userContext))
349+
...(await UserRoleClaim.build(input.userId, input.recipeUserId, input.tenantId, undefined, input.userContext))
350350
};
351351

352352
/*

v2/src/plugins/codeTypeChecking/jsEnv/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"socket.io": "^4.6.1",
5555
"socketio": "^1.0.0",
5656
"supertokens-auth-react": "^0.36.0",
57-
"supertokens-node": "^16.5.0",
57+
"supertokens-node": "github:supertokens/supertokens-node#feat/mfa/base",
5858
"supertokens-node7": "npm:[email protected]",
5959
"supertokens-react-native": "^4.0.0",
6060
"supertokens-web-js": "^0.8.0",

0 commit comments

Comments
 (0)