Iām trying to set up my passport for the first time and will go with just one Google login option. I registered with google apis, so I have all the settings. the relavant code is below, but when my application calls '/auth/google/' , it just fails without an answer or error message. I switched the configuration to a bunch of ways to no avail. I also replaced passport.authenticate('google') an anonymous function using console.log to check if my web service is working correctly, and it does. So I know that it comes to passport.authenticate('google') .
// serialize session passport.serializeUser(function (user, done) { done(null, user.id); }); passport.deserializeUser(function (obj, done) { done(null, obj); }); // use google strategy passport.use(new googleStrategy({ clientID: config.google.clientID, clientSecret: config.google.clientSecret, callbackURL: config.google.callbackURL, scope: 'https://www.google.com/m8/feeds https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile' }, function(accessToken, refreshToken, profile, done) { console.log(profile); } )); app.use(passport.initialize()); app.use(passport.session()); app.get('/auth/google', passport.authenticate('google')); app.get('/auth/google/callback', passport.authenticate('google', { failureRedirect: '/', scope: 'https://www.google.com/m8/feeds' }), signin);
EDIT: Here is my http request, I am using angular, and this function is bound to the ng click on the button.
$scope.signIn = function () { $http({method: 'GET', url: '/auth/google'}). success(function (data, status, headers, config) { console.log('success'); }). error(function (data, status, headers, config) { console.log(data); console.log(status); console.log(headers); console.log(config); }); };
These logs do not return anything.
Collin estes
source share