SuperTokens

SuperTokens

  • Docs
  • Discord
  • Blog

›Sign Up Form

SIDEBAR_REPLACE_DOC_Introduction

  • Introduction

Quick setup

  • Video tutorial & Architecture
  • Frontend
  • Backend
  • Core

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

    Database Setup

    • MySQL
    • PostgreSQL

Common customizations

  • Sign Out
  • Sign Up Form

    • About
    • Adding Extra Fields
    • Adding / Modifying field validators
    • Embed in a page
    • Handling signup success
    • Terms of service & Privacy policy links

    Sign In Form

    • About
    • Adding / Modifying field validators
    • Password managers
    • Embed in a page
    • Show Sign In by default

    Reset Password

    • About
    • Reset password email
    • Embed in a page

    Email Verification

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

    Sessions

    • About
    • Cookie Consent
    • Creating a new session
    • Session Verification in API
    • Change session timeout
    • Checking if a session exists on the frontend
    • Get user information on the frontend
    • Using with FaunaDB

    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

Advanced users

    Advanced session management

    • Share sessions across sub domains
    • Anti CSRF
    • JWT Signing key rotation
    • Access token blacklisting
    • Customizing Error Handling

    Supertokens Core config

    • Adding API Keys
    • Tuning Performance
    • Logging
    • Rename database tables

    Make your own frontend

    • Sign-up / Sign-in custom theme
    • Reset password custom theme

    Make your own backend

    • Sign up custom API
    • Sign in custom API
    • Reset password custom APIs

NextJS

  • SuperTokens with NextJS
  • Deploy with Vercel
  • Deploy with Netlify

SIDEBAR_REPLACE_DOC_SDKs

  • SDKs

SIDEBAR_REPLACE_DOC_Compatibility Table

  • Compatibility Table

Migration

  • Migrating from an older version of SuperTokens
  • Migrating to SuperTokens
  • Migrating away from SuperTokens
  • From managed service to self hosted

Handling signup success

There are multiple reasons why you would like to get notified about a successful Signup.

Redirect to a specific URL

SuperTokens.init({
    appInfo: {...},
    recipeList: [
        EmailPassword.init({
           getRedirectionURL (context) {
                if (context.action === "SUCCESS") {
                    return "/dashboard";
                }
            }
        }),
        Session.init()
    ]
});

The user will be redirected to the provided URL on:

  • Successful sign up
  • Successful sign in
  • Successful email verification.
  • If the user is already logged in.

This is useful in the following cases:

  • Custom routing based on who signed up (useful for multi tenancy scenarios)
  • Custom routing based on AB Testing

Please refer to the auth-react reference API for more information on getRedirectionURL hook.

Store analytics events

This method allows you to have much more control of events that occur immediately after a successful sign up:

  • Registering a user to an analytics service
  • Sending analytics events post sign up
SuperTokens.init({
    appInfo: {...},
    recipeList: [
        EmailPassword.init({
    onHandleEvent = async (context) => {
            if (context.action === "SESSION_ALREADY_EXISTS") {
                // TODO:
            } else {
                let {id, email} = context.user;
                if (context.action === "SIGN_IN_COMPLETE") {
                    // TODO:
                } else {
                    // context.action === "SIGN_UP_COMPLETE"
                    // TODO:
                }
            }
        }
        }),
        Session.init()
    ]
});

Please refer to the auth-react reference API for more information on onHandleEvent hook.

← Embed in a pageTerms of service & Privacy policy links →