Menu

1 / 2

Sign In With LinkedIn Using OpenID Connect in Next.js 16

DEV Community·Nicolas Lecocq·6 months ago
#lpi7uO7b
#nextjs#oauth#typescript#linkedin#token
Reading 0:00
15s threshold

LinkedIn finally moved Sign In to OpenID Connect a while back. Most of the tutorials still floating around the internet show the legacy v1 OAuth dance with r_liteprofile and r_emailaddress scopes. Those are deprecated. If you copy them, your callback will work for a while and then mysteriously stop, which is the worst kind of bug.

Here is the flow that actually works in 2026 with Next.js 16 and NextAuth v5.

The scopes you want

Forget r_liteprofile and r_emailaddress . The current Sign-In product asks for:

openid profile email

Enter fullscreen mode

Exit fullscreen mode

Three scopes, lowercase, space separated. That is the entire request. LinkedIn returns a standard OIDC ID token plus a regular access token. No more profile-specific endpoints, no more email-specific endpoints. The user identity ships in the token claims.

The provider config in NextAuth v5

NextAuth v5 has a built-in LinkedIn provider, but it ships with the legacy scopes. You need to override it.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.