Skip to main content

LinkedIn

Follow these steps to add LinkedIn as a social sign-in provider to your project using the Ory Console:

  1. Go to AuthenticationSocial Sign-In in the Ory Console.
  2. Click the switch next to the LinkedIn logo to start the configuration.
  3. Copy the Redirect URI and save it for later use.
  4. Create a LinkedIn application, verify it and activate Sign In with LinkedInV2.
  5. Add the saved Redirect URI from Ory to the Authorized redirect URLs in the LinkedIn Auth configuration.
  6. The following Scopes are available once Sign In with LinkedInV2 has been activated:
    • openid
    • profile
    • email
  7. Copy the following data from the LinkedIn Auth page to the corresponding fields in the form in the Ory Console:
  • Client ID
  • Client secret
  1. In the Scopes field of the form in the Ory Console, add the following scopes:

    • openid
    • profile
    • email
  2. In the Data Mapping field of the form in the Ory Console, add the following Jsonnet code snippet, which maps the desired claims to the Ory Identity schema:

    local claims = {
    email_verified: false,
    } + std.extVar('claims');
    {
    identity: {
    traits: {
    // Allowing unverified email addresses enables account
    // enumeration attacks, if the value is used for
    // verification or as a password login identifier.
    //
    // Therefore we only return the email if it (a) exists and (b) is marked verified
    // by LinkedIn.
    [if 'email' in claims && claims.email_verified then 'email' else null]: claims.email,
    },
    },
    }
    danger

    Don't save secrets such as API keys, credentials, or personal data directly in Jsonnet code snippets. Jsonnet code snippets used for data mapping aren't stored in an encrypted format in Ory Network.

  3. Click Save Configuration.

Troubleshooting

When you add a social sign-in provider, you can encounter common problems such as:

  • Redirect URI mismatch
  • Redirect loops during registration
  • Domain verification issues

To troubleshoot those issues, read Social sign-in troubleshooting.

Legacy LinkedIn provider

The steps above describe the linkedin_v2 provider. If your application currently uses the old linkedin, it will continue to work from our side. But if you need to change the settings or add a new provider, use the linkedin_v2 provider.