This is a contributors guide and NOT a user guide. Please visit these docs if you are using or evaluating SuperTokens.
RecipeModule is the abstract base class that all recipes (their
recipe.ts file) must implement, and
AuthRecipeModule is the abstract class the extends
RecipeModule and all auth recipes must implement.
An auth recipe is a recipe that has user sign up / sign in (they create their own user). So emailpassword is an auth recipe, whereas session is not an auth recipe. So emailpassword extends
AuthRecipeModule and session directly extends
- All recipes might need to redirect users based on some
contextobject. So we have a function
getDefaultRedirectionURLthat a child recipe class can implement to take care of redirection.
- The base class also contains some common helper method related to redirecting a user.
- A recipe may have a feature in which case get can implement the
getFeatureComponentfunctions. A feature is a part of a recipe that has it's own UI and is displayed based on some rule.
- This class also holds some config values that are common for all recipes. The config contains:
apiDomain..): These can be used by the recipe's logic as and when needed.
- User hook functions:
useShadowDom: If this recipe should use the shadow dom or not.
- Finally, since all recipes extend this class, we can use this class as a type in the user's config input for
- It adds the email verification recipe to this recipe - since all auth recipes (as of this writing) have an email and the user should be able to verify the email.
- Provides some common helper functions for the recipe's logic to use:
- redirection to auth screen
- Handles redirection to the sign up / in screen and to post sign in / up screen.