SuperTokens

SuperTokens

  • Docs
  • Discord
  • Blog

›Email Verification

SIDEBAR_REPLACE_DOC_Introduction

  • Introduction

Quick setup

  • Video tutorial
  • Frontend
  • Backend

Common customizations

  • Sign Out
  • Sign Up Form

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

    Sign In Form

    • Prerequisite
    • Adding / Modifying field validators
    • Password managers
    • Embed in a page

    Reset Password

    • About
    • Reset password email
    • Embed in a page

    Email Verification

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

    Sessions

    • About

    Styling

    • Changing Colours
    • Changing Style via CSS
    • Themes

    Changing base path

    • Website Base Path
    • API Base Path

    Multi Tenancy

    • About
    • One login, many sub domains
    • One login per sub domain
  • User Pagination

NextJS

  • SuperTokens with NextJS

About

Email verification is turned off by default. It is strongly encouraged to enable it to ensure the authenticity of your users

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

// in your frontend code

SuperTokens.init({
    appInfo: {...},
    recipeList: [
        EmailPassword.init({
            emailVerificationFeature: {
                mode: "REQUIRED"
            }
        }),
        Session.init()
    ]
});

When a new user sign up, 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 code
SuperTokens.init({
    appInfo: {...},
    recipeList: [
        EmailPassword.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 →