Build a custom flow for authenticating with enterprise connections
Before you start
You must configure your application instance through the Clerk Dashboard for the enterprise connection(s) that you want to use. Visit the appropriate guide for your platform to learn how to configure your instance.
Create the sign-up and sign-in flow
When using Enterprise SSO, the sign-in and sign-up flows are equivalent. A successful Enterprise SSO flow consists of the following steps:
- Start the Enterprise SSO flow by calling
SignIn.authenticateWithRedirect(params)
orSignUp.authenticateWithRedirect(params)
. Both of these methods require aredirectUrl
param, which is the URL that the browser will be redirected to once the user authenticates with the identity provider. - Create a route at the URL that the
redirectUrl
param points to. The following example names this route/sso-callback
. This route should either call theClerk.handleRedirectCallback()
method or render the prebuilt<AuthenticateWithRedirectCallback/>
component.
The following example shows two files:
- The sign-in page where the user can start the Enterprise SSO flow.
- The SSO callback page where the flow is completed.
Enterprise account transfer flows
It is common for users who are authenticating with an enterprise account to use a sign-in button when they mean to sign-up, and vice versa. For those cases, the SignIn
and SignUp
objects have a transferable
status that indicates whether the user can be transferred to the other flow.
If you would like to keep your sign-in and sign-up flows completely separate, then you can skip this section.
The following example demonstrates how to handle these cases in your sign-in flow. To apply the same logic to the sign-up flow, simply replace signIn.authenticateWithRedirect()
with signUp.authenticateWithRedirect()
in your code.
Feedback
Last updated on