Hi,
I've got client (cordova plugin) logging in ok and getting the idtoken on android device.
I then post this to my server (localhost). (req.body.id_token) I get no errors:
I tried another plugin that verifies the idtoken and that works.
Code:
passport.use(new GoogleTokenStrategy({
clientID: '123433.apps.googleusercontent.com',
getGoogleCerts: null
},
function(parsedToken, googleId, done) {
console.log(parsedToken); <--------- Never gets here
User.findOrCreate({ googleId: googleId }, function (err, user) {
return done(err, user);
});
}
));
router.post('/auth/google', function(req, res, next){
verifier.verify(req.body.id_token, '1234.apps.googleusercontent.com', function (err, tokenInfo) {
if (!err) {
// use tokenInfo in here.
console.log(tokenInfo); <--gets here OK
}
});
passport.authenticate('google-id-token', function(req, res){
res.send(req.user? 200 : 401); <-- never gets here.
});
});
I stepped into passport/lib/authenticate.js line 81
and code never enters the function below.
return function authenticate(req, res, next) {
I believe I'm overlooking something obvious but its taking me a very long time to find out what.
Any clues appreciated!
Thanks
Hi, I've got client (cordova plugin) logging in ok and getting the idtoken on android device. I then post this to my server (localhost). (req.body.id_token) I get no errors: I tried another plugin that verifies the idtoken and that works.
Code:
passport.use(new GoogleTokenStrategy({ clientID: '123433.apps.googleusercontent.com', getGoogleCerts: null }, function(parsedToken, googleId, done) { console.log(parsedToken); <--------- Never gets here User.findOrCreate({ googleId: googleId }, function (err, user) { return done(err, user); }); } ));
router.post('/auth/google', function(req, res, next){ verifier.verify(req.body.id_token, '1234.apps.googleusercontent.com', function (err, tokenInfo) { if (!err) { // use tokenInfo in here. console.log(tokenInfo); <--gets here OK } }); passport.authenticate('google-id-token', function(req, res){ res.send(req.user? 200 : 401); <-- never gets here. }); });
I stepped into passport/lib/authenticate.js line 81 and code never enters the function below. return function authenticate(req, res, next) {
I believe I'm overlooking something obvious but its taking me a very long time to find out what. Any clues appreciated! Thanks