DEV Community

Sonde Omotayo
Sonde Omotayo

Posted on

🔐 Fixing the LinkedIn OAuth Login Issue — The OpenID Connect Update

If you’ve been trying to implement LinkedIn login recently and suddenly started getting mysterious “Something went wrong” errors, you’re not alone. LinkedIn has quietly introduced a major change to its OAuth system — and older login code has stopped working as a result.

This blog walks you through what changed, why old apps break, and how to fix it using the new OpenID Connect approach.

⚠️ What Broke

Previously, you could fetch user data with scopes like:

r_liteprofile

r_emailaddress

And then call:

https://api.linkedin.com/v2/me

https://api.linkedin.com/v2/emailAddress

However, with new apps created in the LinkedIn developer portal, these scopes and endpoints no longer work. If you try, you’ll see errors like:

"Something went wrong"
or
"Invalid scope"

💡 What Changed

LinkedIn has switched its sign-in flow to use OpenID Connect (OIDC) — an identity layer built on top of OAuth 2.0.

Key changes:

New sign-in label: “Sign in with LinkedIn using OpenID Connect”

Requires OpenID Connect access to be enabled on your app

New supported scopes:

openid

profile

email

New endpoint to fetch user profile:

https://api.linkedin.com/v2/userinfo

This means old scopes and endpoints no longer work for new apps.

🛠 How to Fix the OAuth Login

Here’s the correct approach to make LinkedIn OAuth login work again:

  • Step 1 — Create a New App

Go to the LinkedIn Developer Portal

Create a new application

Fill in basic info (name, logo, privacy URL — can be http://localhost)

Enable OpenID Connect under “Products”

Copy your Client ID and Client Secret

  • Step 2 — Set Your Redirect URI

Add your redirect URI (like http://localhost/project/callback) in your app’s OAuth 2.0 settings

This must match exactly with what you use in your code

  • Step 3 — Implement the OAuth Flow

Authorization URL:

https://www.linkedin.com/oauth/v2/authorization
  ?response_type=code
  &client_id=YOUR_CLIENT_ID
  &redirect_uri=YOUR_REDIRECT_URI
  &scope=openid%20profile%20email

Enter fullscreen mode Exit fullscreen mode

Exchange code for token:

POST https://www.linkedin.com/oauth/v2/accessToken
  grant_type=authorization_code
  code=AUTH_CODE
  redirect_uri=YOUR_REDIRECT_URI
  client_id=YOUR_CLIENT_ID
  client_secret=YOUR_CLIENT_SECRET
Enter fullscreen mode Exit fullscreen mode

Fetch user info:

GET https://api.linkedin.com/v2/userinfo
Authorization: Bearer ACCESS_TOKEN

This userinfo endpoint returns the user’s name, email, and LinkedIn ID.

✅ Summary

If your LinkedIn login suddenly stopped working:

Don’t reuse old apps created before this change.

Create a new app, enable OpenID Connect, and use:

Scopes: openid profile email

Endpoint: https://api.linkedin.com/v2/userinfo

Once you apply these changes, your LinkedIn login will work again using the modern and secure OpenID Connect flow.

📌 Final Tip

Always keep an eye on the LinkedIn Developer documentation — OAuth changes like this are often introduced silently and can break existing integrations without warning.

Top comments (0)