The Remix SDK is in maintenance mode and will only receive security updates. Please migrate to the React Router SDKReact Router Icon for continued development and new features.
The rootAuthLoader() function is a helper function that provides the authentication state to your Remix application.
To configure Clerk in your Remix app, you must export the rootAuthLoader() function as the root loader() function.
app/root.tsx
// Your other imports// Import `rootAuthLoader`import { rootAuthLoader } from'@clerk/remix/ssr.server'// Export `rootAuthLoader()` as the root route `loader`exportconstloader:LoaderFunction= (args) =>rootAuthLoader(args)// The rest of your code
The rootAuthLoader() function accepts an optional object. The following options are available:
Name
audience?
Type
string | string[]
Description
A string or list of audiences. If passed, it is checked against the aud claim in the token.
Name
authorizedParties?
Type
string[]
Description
An allowlist of origins to verify against, to protect your application from the subdomain cookie leaking attack. For example: ['http://localhost:3000', 'https://example.com']
Name
domain?
Type
string
Description
The domain used for satellites to inform Clerk where this application is deployed.
Name
isSatellite?
Type
boolean
Description
When using Clerk's satellite feature, this should be set to true for secondary domains.
Name
jwtKey
Type
string
Description
Used to verify the session token in a networkless manner. Supply the JWKS Public Key from the API keys page in the Clerk Dashboard. It's recommended to use the environment variable instead. For more information, refer to Manual JWT verification.
This URL will be used for any redirects that might happen and needs to point to your primary application on the client-side. This option is optional for production instances. It is required to be set for a satellite application in a development instance. It's recommended to use the environment variable instead.
Name
signUpUrl
Type
string
Description
This URL will be used for any redirects that might happen and needs to point to your primary application on the client-side. This option is optional for production instances but must be set for a satellite application in a development instance. It's recommended to use the environment variable instead.
Name
signInFallbackRedirectUrl?
Type
string
Description
The fallback URL to redirect to after the user signs in, if there's no redirect_url in the path already. Defaults to /. It's recommended to use the environment variable instead.
Name
signUpFallbackRedirectUrl?
Type
string
Description
The fallback URL to redirect to after the user signs up, if there's no redirect_url in the path already. Defaults to /. It's recommended to use the environment variable instead.
Name
signInForceRedirectUrl?
Type
string
Description
If provided, this URL will always be redirected to after the user signs in. It's recommended to use the environment variable instead.
Name
signUpForceRedirectUrl?
Type
string
Description
If provided, this URL will always be redirected to after the user signs up. It's recommended to use the environment variable instead.