init
EmailPassword To start using the "EmailPassword" recipe for Sign-up / Sign-in, start by importing the EmailPassword
module from the library and add it to the recipeList
:
import SuperTokens from "supertokens-auth-react";
import EmailPassword from "supertokens-auth-react/recipe/emailpassword";
SuperTokens.init({
appInfo: {...},
recipeList: [
EmailPassword.init()
]
});
You can customize the EmailPassword
module by overwriting the following configs:
Here is an example of a fully customized "EmailPassword" configuration. Make sure to only include the ones that you want to customize.
SuperTokens.init({
appInfo: {...},
recipeList: [
EmailPassword.init({
palette: {...},
signInAndUpFeature: {
onSuccessRedirectURL: '/',
disableDefaultImplementation: false,
signUpForm: {...},
signInForm: {...}
},
resetPasswordUsingTokenFeature: {
disableDefaultImplementation: false
enterEmailForm: {...}
submitNewPasswordForm: {...}
}
})
]
});
Config values
- palette:
- Description: The palette allows you to customize basic colours of the Sign-up / Sign-in / Reset Password forms. Read the common customizations guide for more information about the palette.
signInAndUpFeature
onSuccessRedirectURL:
- Description: SuperTokens will redirect to this URL on successful signin or signout. This should be the entry point for your application.
- Default:
"/"
- Example:
onSuccessRedirectURL: "/dashboard"
disableDefaultImplementation:
- Description: When true, the default route (
/auth
) for Sign-up / Sign-in is disabled. - Default:
"false"
- Example:
disableDefaultImplementation: "true"
- Description: When true, the default route (
signUpForm:
- Description: The signUpForm configuration allows you to update styles, create new Sign up fields, add custom validators. More information in the corresponding sign up section
signInForm:
- Description: The
signInForm
configuration allows you to update styles, customize "email"|"password" fields, add custom validators. More information in the corresponding sign in section
- Description: The
resetPasswordUsingTokenFeature
disableDefaultImplementation:
- Description: When true, the default route (
/auth/reset-password
) for reset password is disabled. - Default:
"false"
- Example:
disableDefaultImplementation: "true"
- Description: When true, the default route (
enterEmailForm:
- Description: The signUpForm configuration allows you to update styles. More information in the corresponding reset password email section
submitNewPasswordForm:
- Description: The signUpForm configuration allows you to update styles. More information in the corresponding reset password new password section