Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update linkedin.ts to support new scopes #11805

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

PragyanSubedi
Copy link

LinkedIn has updated scopes for OAuth and doesn't support older scopes anymore.

https://next-auth.js.org/errors#oauth_callback_handler_error unauthorized_scope_error {
  error: {
    message: 'unauthorized_scope_error',
    stack: 'Error: unauthorized_scope_error\n' +
      '    at oAuthCallback (webpack-internal:///(rsc)/./node_modules/next-auth/core/lib/oauth/callback.js:39:19)\n' +
      '    at Object.callback (webpack-internal:///(rsc)/./node_modules/next-auth/core/routes/callback.js:52:39)\n' +
      '    at AuthHandler (webpack-internal:///(rsc)/./node_modules/next-auth/core/index.js:208:41)\n' +
      '    at async NextAuthRouteHandler (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:69:28)\n' +
      '    at async NextAuth._args$ (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:105:16)\n' + 
      '    at async C:\\D\\project-giga\\node_modules\\next\\dist\\compiled\\next-server\\app-route.runtime.dev.js:6:55038\n' +
      '    at async ek.execute (C:\\D\\project-giga\\node_modules\\next\\dist\\compiled\\next-server\\app-route.runtime.dev.js:6:45808)\n' +
      '    at async ek.handle (C:\\D\\project-giga\\node_modules\\next\\dist\\compiled\\next-server\\app-route.runtime.dev.js:6:56292)\n' +
      '    at async doRender (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\base-server.js:1377:42)\n' +  
      '    at async cacheEntry.responseCache.get.routeKind (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\base-server.js:1587:40)\n' +
      '    at async DevServer.renderToResponseWithComponentsImpl (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\base-server.js:1507:28)\n' +
      '    at async DevServer.renderPageComponent (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\base-server.js:1931:24)\n' +
      '    at async DevServer.renderToResponseImpl (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\base-server.js:1969:32)\n' +
      '    at async DevServer.pipeImpl (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\base-server.js:920:25)\n' +
      '    at async NextNodeServer.handleCatchallRenderRequest (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\next-server.js:272:17)\n' +
      '    at async DevServer.handleRequestImpl (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\base-server.js:816:17)\n' +
      '    at async C:\\D\\project-giga\\node_modules\\next\\dist\\server\\dev\\next-dev-server.js:339:20\n' +     
      '    at async Span.traceAsyncFn (C:\\D\\project-giga\\node_modules\\next\\dist\\trace\\trace.js:154:20)\n' + 
      '    at async DevServer.handleRequest (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\dev\\next-dev-server.js:336:24)\n' +
      '    at async invokeRender (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\lib\\router-server.js:174:21)\n' +
      '    at async handleRequest (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\lib\\router-server.js:353:24)\n' +
      '    at async requestHandlerImpl (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\lib\\router-server.js:377:13)\n' +
      '    at async Server.requestListener (C:\\D\\project-giga\\node_modules\\next\\dist\\server\\lib\\start-server.js:141:13)',
    name: 'Error'
  },
  error_description: 'Scope "r_emailaddress" is not authorized for your application',
  providerId: 'linkedin',
  message: 'unauthorized_scope_error'
}

☕️ Reasoning

LinkedIn OAuth Scopes are changed from "r_liteprofile r_emailaddress" to "openid profile email"

📌 Resources

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
LinkedIn has updated scopes for OAuth and doesn't support r_emailaddress anymore.

error_description: 'Scope "r_emailaddress" is not authorized for your application',
  providerId: 'linkedin',
  message: 'unauthorized_scope_error'
Copy link

vercel bot commented Sep 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ❌ Failed (Inspect) Sep 11, 2024 1:23am
next-auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 11, 2024 1:23am

Copy link

vercel bot commented Sep 11, 2024

@PragyanSubedi is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added providers legacy Refers to `next-auth` v4. Minimal maintenance. labels Sep 11, 2024
@balazsorban44 balazsorban44 merged commit 81cbe2d into nextauthjs:v4 Sep 15, 2024
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy Refers to `next-auth` v4. Minimal maintenance. providers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants