auth0 / passport-linkedin-oauth2

Passport Strategy for LinkedIn OAuth 2.0
MIT License
119 stars 107 forks source link

linkedin redirecting always failure url why? #76

Open sukeerthimogallapalli opened 5 years ago

sukeerthimogallapalli commented 5 years ago

Hi everyone, I define 2 { successRedirect: '/', failureRedirect: '/login', }. When I press Allow button and then my page redirect failureRedirect's url (/login). Why ?

router.get('/auth/linkedin/callback', passportLinkedIn.authenticate('linkedin', { successRedirect: '/', failureRedirect: '/login' }), (error, req, res, next) => { console.log() }) passport.use(new LinkedInStrategy({ clientID: config.linkedin.clientID, clientSecret: config.linkedin.clientSecret, callbackURL: config.linkedin.callbackURL, profileFields: [ "first-name", "last-name", "email-address", "headline", "summary", "industry", "picture-url", "positions", "public-profile-url", "location" ], scope: ['r_basicprofile', 'r_emailaddress'], state: true, passReqToCallback: true }, function (req, accessToken, refreshToken, profile, done) { console.log('profile---------------------------------------------------------------------------------------------------') process.nextTick(function () { return done(null, profile); }) }))

robechun commented 4 years ago

Want to leave a note here for future users-- Looks like setting the field state = true breaks functionality and therefore will always redirect to failureUrl

eric573 commented 3 years ago

I can verify this behavior. We have to set state=false to make it work.

codestergit commented 2 years ago

Yes any solution??