Skip to content
Esc
navigateopen⌘Jpreview
Dashboard
On this page

Disable Sign Up

Learn how to disable the sign up flow

Learn how to disable the sign up flow for the EmailPassword recipe.


Overview

In order to prevent users from signing up directly through the frontend, you can disable the sign up flow. This can be done in two steps:

  • Update the UI to get rid of any sign up information
  • Change the Backend SDK to prevent sign up attempts

Before you start

This guide assumes that you already have configured your application to use SuperTokens for authentication. If you have not, please check the Quickstart Guide.

Remove the sign up UI

UI type

Remove the sign up UI by overriding the AuthPageComponentList component and setting the showSuperTokensAuth prop to false.

Remove the sign up UI by customizing the CSS of the authentication page.

import React from "react";
import { SuperTokensWrapper } from "supertokens-auth-react";
import { AuthRecipeComponentsOverrideContextProvider } from "supertokens-auth-react/ui";
import { EmailPasswordComponentsOverrideProvider } from "supertokens-auth-react/recipe/emailpassword";
import { ThirdpartyComponentsOverrideProvider } from "supertokens-auth-react/recipe/thirdparty";

function App() {
  return (
    <SuperTokensWrapper>
      <AuthRecipeComponentsOverrideContextProvider
        components={{
          AuthPageComponentList_Override: ({ DefaultComponent, ...props }) => {
            return <DefaultComponent {...props} hasSeparateSignUpView={false} />;
          },
        }}
      ></AuthRecipeComponentsOverrideContextProvider>
    </SuperTokensWrapper>
  );
}

export default App;
// this goes in the auth route config of your frontend app (once the pre built UI script has been loaded)

supertokensUIInit({
  appInfo: {
    apiDomain: "...",
    appName: "...",
    websiteDomain: "...",
  },
  style: `
        [data-supertokens~=authPage] [data-supertokens~=headerSubtitle] {
            display: none;
        }
    `,
  recipeList: [
    /* ... */
  ],
});

Disable the Backend SDK sign up endpoints

Override the Backend SDK API functions to prevent sign up attempts.

import SuperTokens from "supertokens-node";
import EmailPassword from "supertokens-node/recipe/emailpassword";

SuperTokens.init({
  appInfo: {
    apiDomain: "...",
    appName: "...",
    websiteDomain: "...",
  },
  supertokens: {
    connectionURI: "...",
  },
  recipeList: [
    EmailPassword.init({
      override: {
        apis: (originalImplementation) => {
          return {
            ...originalImplementation,
            signUpPOST: undefined,
          };
        },
      },
    }),
  ],
});
import (
	"github.com/supertokens/supertokens-golang/recipe/emailpassword"
	"github.com/supertokens/supertokens-golang/recipe/emailpassword/epmodels"
	"github.com/supertokens/supertokens-golang/supertokens"
)

func main() {
	supertokens.Init(supertokens.TypeInput{
		RecipeList: []supertokens.Recipe{
			emailpassword.Init(&epmodels.TypeInput{
				Override: &epmodels.OverrideStruct{
					APIs: func(originalImplementation epmodels.APIInterface) epmodels.APIInterface {
						originalImplementation.SignUpPOST = nil
						return originalImplementation
					},
				},
			}),
		},
	})
}
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import emailpassword
from supertokens_python.recipe.emailpassword.interfaces import APIInterface

def apis_override(original_impl: APIInterface):
    original_impl.disable_sign_up_post = True
    return original_impl

init(
    app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
    framework='...',
    recipe_list=[
        emailpassword.init(
            override=emailpassword.InputOverrideConfig(
                apis=apis_override
            ),
        )
    ]
)

See also

API reference

API schema and response details