Last updated

Bring your own sign-up form

If your application requires fields not included in Frontegg's default sign-up form, such as country or organization type, you can create your own custom sign-up form and UI. Use Frontegg's sign-up API to register users and then seamlessly redirect them into the application using the appropriate requestAuthorize hook or method, based on the SDK you’re using.

Step 1: Send a sign-up request via API

Frontegg's sign-up API will return an access token and a fe_refresh cookie if there is no email verification forced on the environment. When this endpoint is called from the client - it will set the cookie on the browser level.

Step 2: Call a refresh request

In order for the user to be logged in into your application after the sign-up, you'll need to trigger a refresh request that will check whether there is a valid refresh token on the user's browser and if yes, the user will get automatically logged in, into your application.

You may use either __requestHostedLoginSilentAuthorize or requestAuthorize, there is no significant diffence and you may use either. The below example is from @frontegg/react, but these methods exist in all client-side SDKs.



import { useLoginActions } from '@frontegg/react'

const { __requestHostedLoginSilentAuthorize } = useAuthActions();
const { requestAuthorize } = useLoginActions();

  // afterSignup
  __requestHostedLoginSilentAuthorize()
    .catch(() => {
      // redirect to login
    }).then(() => {
      // redirect to app
    });

That's it! The user has been successfully signed up and redirected as an authenticated user into your application.