adriansteffan
10/08/2023, 2:31 PMSuperTokens.init({
appInfo: {
// learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo
appName: "boilerplate",
apiDomain: "http://localhost:8000",
websiteDomain: "http://localhost:3000",
apiBasePath: "/auth",
websiteBasePath: "/auth"
},
recipeList: [
EmailVerification.init({
mode: "OPTIONAL",
}),
ThirdPartyEmailPassword.init({
useShadowDom: false,
signInAndUpFeature: {
providers: [
Discord.init(),
Google.init(),
Apple.init(),
],
signUpForm: {
termsOfServiceLink: "https://example.com/terms-of-service",
privacyPolicyLink: "https://example.com/privacy-policy",
formFields: [{
id: "password",
label: "Password",
validate: async (value) => {
// Your own validation returning a string or undefined if no errors.
if(value.length < 8){
return "Password has to be at least 8 characters long!";
}
}
}]
},
},
onHandleEvent: async (context) => {
if (context.action === "SESSION_ALREADY_EXISTS") {
return
}
if (context.action === "SUCCESS") {
if (context.isNewRecipeUser && context.user.loginMethods.length === 1) { // sign up
sendSupertokensEmail()
}
}
}
}),
Session.init()
]
});