Skip to main content

Disable the Sing Up Flow

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

What type of UI are you using?

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

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;

Disable the Backend SDK sing up endpoints

Override the Backend SDK API functions to prevent sing 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,
}
}
}
})
]
});

See also