मैं पासपोर्ट-google-OAuth का उपयोग निम्नलिखित नोड कोड ...पासपोर्ट-गूगल-OAuth कॉलबैक काम नहीं कर
app.get('/auth/google', passport.authenticate('google', { scope : ['profile', 'email'] }));
app.get('/auth/google/callback', function(req,res) {
console.log("callback");
passport.authenticate('google', {
successRedirect : '/signin',
failureRedirect : '/signin'
});
});
और ... है
passport.serializeUser(function(user, done) {
console.log("ser");
done(null, user.id);
});
passport.deserializeUser(function(id, done) {
console.log("des");
User.findById(id, function(err, user) {
done(err, user);
});
});
passport.use(new GoogleStrategy({
clientID : 'id',
clientSecret : 'key',
callbackURL : 'http://host/auth/google/callback',
},
function(token, rtoken, profile, done) {
console.log("proc");
console.log(profile);
done(null, profile);
}));
समस्या है, कॉलबैक बुलाया जा रहा है लेकिन कुछ और नहीं होता है। प्रसंस्करण समारोह कभी हिट नहीं करता है। कॉलबैक समय समाप्त हो जाता है। कोई विचार जहां मैं गलत गया?
लाइन 'console.log ("कॉलबैक") है,' निष्पादित? – xShirase
इसके अलावा आप/साइनइन मार्ग कैसा दिखता है? कॉलबैक भी प्राप्त या पोस्ट होना चाहिए। मुझे लगता है कि यह आमतौर पर एक पोस्ट है। –
शायद आपकी समस्या GoogleStrategy में है। इसे आज़माएं: var GoogleStrategy = की आवश्यकता है ('पासपोर्ट-google-oauth')। OAuth2Strategy; – Dyrk