-
Notifications
You must be signed in to change notification settings - Fork 109
Description
InternalOAuthError: failed to fetch user profile
at Strategy. (C:\VsCode\OfficeINK\OfficeInk-api\node_modules\passport-linkedin-oauth2\lib\oauth2.js:57:19)
at passBackControl (C:\VsCode\OfficeINK\OfficeInk-api\node_modules\oauth\lib\oauth2.js:132:9)
at IncomingMessage. (C:\VsCode\OfficeINK\OfficeInk-api\node_modules\oauth\lib\oauth2.js:157:7)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
I have been stuck in this error for 1 week, I googled about this error but couldn't get an updated solution according to new Community Management API of LinkedIn, Please help me @jamescgarrett .
The following is Passport linkedinStrategy configuration :
`require('dotenv').config();
const LinkedInStrategy = require("passport-linkedin-oauth2").Strategy;
const passport = require("passport");
passport.serializeUser((user, done) => {
done(null, user);
});
passport.use(
new LinkedInStrategy(
{
clientID: process.env.LINKEDIN_CLIENT_ID,
clientSecret: process.env.LINKEDIN_CLIENT_SECRET,
callbackURL: 'http://localhost:5000/auth/linkedin/callback',
scope: ['openid', 'profile', 'email'],
state: true,
},async (accessToken, refreshToken, done) => {
try {
const userInfo = await linkedin.getProfile(
process.env.LINKEDIN_CLIENT_ID,
process.env.LINKEDIN_CLIENT_SECRET,
accessToken
);
console.log(userInfo)
done(null, userInfo);
} catch (err) {
console.log(err)
done(err, false);
}
}
)
);
passport.deserializeUser((user, done) => {
done(null, user);
});`
server running on localhost:5000,
Please help me, Its a lot to me.
Thanks ,