Docs

Add LinkedIn Open ID Connect (OIDC) as a social connection

You will learn the following:

  • Use LinkedIn OIDC to authenticate users with OAuth.

Configure for your development instance

For development instances, Clerk uses preconfigured shared OAuth credentials and redirect URIs — no other configuration is needed.

To configure your development instance, follow these steps:

  1. Navigate to the Clerk Dashboard.
  2. In the top navigation, select Configure. Then in the sidebar, select SSO Connections.
  3. Select the Add connection button, and select For all users.
  4. In the Choose provider dropdown, select LinkedIn.
  5. Select Add connection.

Configure for your production instance

In production instances, you must provide custom credentials, which involves generating your own Client ID and Client Secret using your LinkedIn Developer account.

To configure your production instance, follow these steps:

Tip

If you already have a LinkedIn app you'd like to connect to Clerk, select your app from the LinkedIn Developer Portal and skip to the next step in this tutorial.

  1. On the homepage of the LinkedIn Developer Portal, select Create app. You'll be taken to the Create an app form.
  2. Fill out the form as follows:
    1. Under App name, name the application whatever you'd like. "Clerk Demo App", for example.
    2. Under LinkedIn Page, paste the URL of the LinkedIn page you'd like to associate with the application.
    3. Under App logo, upload an image to represent the application.
    4. Under Legal agreement, select the checkbox to agree to LinkedIn's API Terms of Use.
    5. Finally, select Create app.

Get your Client ID and Client Secret

Once your LinkedIn app is created, you'll be taken to the app's dashboard.

  1. Select the Auth tab.
  2. Under Application credentials, you'll find your Client ID and Primary Client Secret. Copy these values and save them somewhere secure, as they are required to connect your LinkedIn app to your Clerk app.
  3. Keep this page open, as you'll need to come back to it in a moment.

Connect your LinkedIn app and get your redirect URI

  1. Navigate to the Clerk Dashboard.
  2. In the top navigation, select Configure. Then in the sidebar, select SSO Connections.
  3. Select the Add connection button, and select For all users.
  4. In the Choose provider dropdown, select LinkedIn.
  5. Ensure that both Enable for sign-up and sign-in and Use custom credentials are toggled on. Then:
    1. Under Client ID, add the value you copied from Client ID in the LinkedIn dashboard.
    2. Under Client Secret, add the value you copied from Primary Client Secret in the LinkedIn dashboard.
    3. Copy the Redirect URI. You need it to configure your LinkedIn app.
    4. Select Add connection.

Set the Redirect URI for your LinkedIn application

  1. Navigate back to the LinkedIn Developer Portal and go to the Auth tab.
  2. Under the OAuth 2.0 settings section, next to Authorized redirect URLs for your app, select the Edit icon.
  3. Select Add redirect URL and add the Redirect URI you copied from the Clerk Dashboard.

Enable OpenID Connect in your LinkedIn application

  1. Select the Products tab.
  2. Next to Sign In with LinkedIn using OpenID Connect, select Request access.

Note

If you need to ensure the longevity of the user's access token without the need for re-authentication, make sure to obtain approval as a Marketing Developer Platform (MDP) partner. This is not required if you don't directly interact with the LinkedIn API using the access token.

Test your OAuth

The simplest way to test your OAuth is to visit your Clerk application's Account Portal, which is available for all Clerk applications out-of-the-box.

  1. In the navigation sidebar of the Clerk Dashboard, select Account Portal.
  2. Next to the Sign-in URL, select Visit. The URL should resemble:
  3. On the sign-in page, you should see Continue with LinkedIn as an option. Use it to sign in with your LinkedIn account.

Feedback

What did you think of this content?

Last updated on