SuperTokens

SuperTokens

  • Docs
  • Discord
  • Blog

›Email Verification

SIDEBAR_REPLACE_DOC_About this recipe

  • About this recipe

Quick setup

  • Frontend
  • Backend
  • Core

    • Self Hosted setup with Docker
    • Self Hosted setup without Docker
    • Managed Service

    Database Setup

    • MySQL
    • PostgreSQL
    • MongoDB
    • Rename database tables

Common customizations

  • Redirect To Auth Screen
  • Sign Out
  • SignUp Form

    • Prerequisite
    • Adding Extra Fields
    • Adding / Modifying field validators
    • Built in providers
    • Custom providers
    • Embed in a page
    • Terms of service & Privacy policy links
    • Show Sign Up by default

    SignIn Form

    • Prerequisite
    • Adding / Modifying field validators
    • Built in providers
    • Custom providers
    • Password managers
    • Embed in a page
  • Post sign up callbacks
  • Post sign in callbacks
  • User Roles

    • Assigning roles to users
    • Assigning roles to a session
    • Reading roles in an API
    • Reading roles in the frontend
    • Updating roles in a session

    Reset Password

    • About
    • Reset Password Email
    • Embed in a page

    Email Verification

    • About
    • Customising the email sent
    • Embed in a page

    Sessions

    • About
    • Storing session data
    • Session Verification in API
    • Revoking a session manually
    • Change session timeout
    • Checking if a session exists on the frontend
    • Get user information on the frontend
    • Fetching sessions for a user
    • Update JWT Payload
    • Update Session Data
    • Cookies and Https
    • Cookie Consent
    • Share sessions across sub domains
    • Anti CSRF
    • Same site cookies
    • JWT Signing key rotation
    • Access token blacklisting
    • Customizing Error Handling

    Styling

    • Changing Colours
    • Changing Style via CSS
    • Themes

    Changing base path

    • Website Base Path
    • API Base Path
  • User Pagination
  • Core

    • Adding API Keys
    • Tuning Performance
    • Logging

    Core CLI

    • Overview
    • Start
    • List
    • Stop
    • Uninstall

NextJS

  • About
  • 1. Configuration
  • 2. Showing Login UI
  • 3. Adding auth APIs
  • 4. Protecting a website route
  • 5. Session verification

    • 5a. Session verification in an API call
    • 5b. Session verification in getServerSideProps
  • 6. Next steps

SIDEBAR_REPLACE_DOC_Serverless Optimisation

  • Running on serverless env

SIDEBAR_REPLACE_DOC_SDKs API Reference

  • SDKs API Reference

About

Email verification is turned off by default. It is strongly encouraged to enable it to ensure the authenticity of your users. When your users sign up with third party providers, SuperTokens make sure that the email they are using is verified. If it's not the case, SuperTokens will render the email verification page and send a verification email to make sure that your user's address is correct.

When the email was already verified by the third party provider, then this step is ignored.

Here is how to turn on email verification from your front end application:

ReactJS
// in your frontend code

SuperTokens.init({
appInfo: {...},
recipeList: [
ThirdPartyEmailPassword.init({
emailVerificationFeature: {
mode: "REQUIRED"
}
}),

Session.init()
]
});

When a new user sign up with an unverified email, they will receive an email to verify their address and be redirected to the following screen:

After they have clicked on the email, they will see this screen:

Doing operations post email verification

We have defined a callback in the backend SDK which will be called after a successful email verification. You can define the callback for tasks like analytics, sending a user a welcome email, notifying an internal dashboard etc..

NodeJS

SuperTokens.init({
appInfo: {...},
recipeList: [
ThirdPartyEmailPassword.init({
emailVerificationFeature: {
handlePostEmailVerification: (user) => {
let {id, email} = user;
// this is called when this user verifies their email.
}

}
}),

Session.init()
]
});
Note that if you are already using SuperTokens in production and turn on email verification, your users will be redirected to the email verification screen next time they use your application.
← Embed in a pageCustomising the email sent →