Docs

Direct links

Redirect URL

If a user accesses an Account Portal page directly, the redirect_url query param will not be present, so the user cannot be redirected back to your application once they are finished with their Account Portal flow. To prevent this, it is recommend that you always specify the redirect in the link when sharing it.

You can use the following format for your direct links:

https://accounts.<your-domain.com>/<account-portal-page>?redirect_url=<your-redirect-url>

Example

If you use https://accounts.myapp.com/sign-in?redirect_url=https://myapp.com/dashboard

The domain is myapp.com, the user is being linked to the sign-in Account Portal page at http://accounts.myapp.com/sign-in and they will be redirected to https://myapp.com/dashboard after they are signed in.

Fallback redirects

In the case that a user does visit an Account Portal page directly without the query param, you can set up fallback redirects to ensure that the user is redirected back to your application after they are finished with their Account Portal flow.

Sign-in and sign-up

Set the appropriate environment variables to configure the fallback redirects for sign-in and sign-up.

Sign out

Set the post-sign-out redirect by passing the afterSignOutUrl prop to the <ClerkProvider> component. See the reference doc for more information.

Organization redirects

Both the <OrganizationProfile /> and <OrganizationSwitcher /> components accept an afterLeaveOrganizationUrl prop for setting the redirect after leaving an organization.

The <OrganizationSwitcher /> component accepts an afterSelectOrganizationUrl prop for setting the redirect after selecting an organization, and an afterCreateOrganizationUrl prop for setting the redirect after creating an organization.

Prefill sign in and sign up fields

In the case of direct links, the values to be used for prefilling the fields for sign-in or sign-up can be specified via the following query parameters:

  • email_address
  • phone_number
  • username
  • first_name
  • last_name

For example, visiting https://accounts.example.com/sign-in?username=nick will result in the username field being prefilled with the value nick.

Feedback

What did you think of this content?

Last updated on