Add a custom OpenID Connect (OIDC) Provider as an enterprise connection
You will learn the following:
- Add a custom OIDC provider to authenticate users with Enterprise SSO
This guide explains how to use a custom OpenID Connect (OIDC) provider to authenticate users via Enterprise SSO.
To make the setup process easier, it's recommended to keep two browser tabs open: one for the Clerk Dashboard and one for your Identity Provider (IdP).
Set up an enterprise connection in Clerk
- In the Clerk Dashboard, navigate to the SSO Connections page.
- Select Add connection and select For specific domains or organizations.
- Under OpenID Connect (OIDC), select Custom OIDC Provider.
- Add the Name of the connection.
- Add the Key of the provider. This is the provider's unique identifier (cannot be changed after creation).
- Enter the Domain. This is the email domain of the users you want to allow to sign in to your application. Optionally, select an Organization.
- Select Add connection. You will be redirected to the connection's configuration page. Keep this page open.
Configure your IdP
- If necessary, create a new application in your IdP.
- In the connection's configuration page of the Clerk Dashboard, copy the Authorized redirect URI.
- Add the value to your IdP's whitelisted URLs.
- Find your application's Discovery Endpoint, Client ID, and Client Secret and copy them.
Set the Discovery Endpoint, Client ID, and Client Secret in Clerk
- In your IdP settings, copy your application's Discovery Endpoint, Client ID, and Client Secret.
- In the connection's configuration page in the Clerk Dashboard, paste these values in their respective fields.
- Under Scopes, add the minimum required scopes based on the IdP's documentation if needed. Common OIDC scopes include
openid
,email
, andprofile
. - Select Save.
Configure attribute mapping (optional)
Clerk expects the claims returned by your IdP to follow the OIDC Standard. If your provider returns claims in a non-standard format, use the Attribute Mapping section on the connection's configuration page to adjust the mapping of Clerk's user properties to match the IdP's claim attributes.
Allow additional identifiers (optional)
User profile information is sourced from the IdP. To allow users to add new identifiers (e.g., email address or phone number) to their profiles:
- In the connection's configuration page of the Clerk Dashboard, navigate to the Advanced tab.
- Enable Allow additional identifiers.
- Select Save.
Enable the connection for Clerk
To make the connection available for your users to authenticate with:
- Navigate back to the Clerk Dashboard where you should still have the connection's configuration page open. If not, navigate to the SSO connections page and select the connection.
- At the top of the page, toggle on Enable connection and select Save.
Test your connection
The simplest way to test your enterprise connection is to visit your Clerk app's Account Portal, which is available for all Clerk apps out-of-the-box.
- In the Clerk Dashboard, navigate to the Account Portal page.
- Next to the Sign-in URL, select Visit. The URL should resemble:
- For development –
https://your-domain.accounts.dev/sign-in
- For production –
https://accounts.your-domain.com/sign-in
- For development –
- Sign in with your IdP account.
Feedback
Last updated on