Next.js Discord

Discord Forum

LinkedIn with Next-Auth throws me error

Unanswered
Tricolored Heron posted this in #help-forum
Open in Discord
Tricolored HeronOP
I'm trying to use Next-Auth with LinkedIn and I'm getting this error.

[next-auth][error][OAUTH_CALLBACK_ERROR] https://next-auth.js.org/errors#oauth_callback_error jwks_uri must be configured on the issuer { error: TypeError: jwks_uri must be configured on the issuer at assertIssuerConfiguration

The login process is going perfectly. But after log into the LinkedIn it will not return to me User Data. And also user will not showing as log in. Pararrely I'm using Google sign-in and it works perfect. The problem comming up with the LinkedIn. Someone can solve this error it would be really helpfull.

I tried bellow code.

LinkedInProvider({
clientId: process.env.LINKEDIN_CLIENT_ID as string,
clientSecret: process.env.LINKEDIN_CLIENT_SECRET as string,
authorization: {
params: { scope: 'openid profile email' },
},
issuer: 'https://www.linkedin.com',
jwks_endpoint: 'https://www.linkedin.com/oauth/openid/jwks',
profile(profile, tokens) {
const defaultImage =
'https://cdn-icons-png.flaticon.com/512/174/174857.png';
return {
id: profile.sub,
name: profile.name,
email: profile.email,
image: profile.picture ?? defaultImage,
};
},
}),

10 Replies

It looks like you might have jwks_endpoint instead of jwks_uri?
Tricolored HeronOP
Yes I think I don’t know how to solve this. The LinkedIn login process is working fine. But it does not provide the user details back to the application. Please hel me 😊
Tricolored HeronOP
No
After changing it to jwks_uri I’m getting this type error
hmm, so that's not it. The only thing I can think of is something missing on the linkedIn config-side
The error message links to this
OAUTH_CALLBACK_ERROR
This can occur during the handling of the callback if the code_verifier cookie was not found or an invalid state was returned from the OAuth provider.
Tricolored HeronOP
In my LinkedIn congratulations all are set to be correctly. Couldn’t find solution to this problem. LinkedIn is changed their Signin options from oauth to openid. So that’s why next Auth is not supporting this I think. 😦
*configurations