Note that there are some explanatory texts on larger screens.

plurals
  1. POPassport.js authenticate not working
    text
    copied!<p>I'm trying to set up passport for the first time and going with just a single google sign-in option. I registered with google apis so i have all that setup. the relavant code is below, but when my app makes the <code>'/auth/google/'</code> call it just fails with no response or error message. I've switched up the configuration a bunch of ways to no avail. I've also replaced the <code>passport.authenticate('google')</code> with an anonymous function with a console.log to double check my web service is operating correctly and it is. So I know it is getting to the <code>passport.authenticate('google')</code>.</p> <pre><code> // 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); </code></pre> <p>EDIT: Here is my http request, I'm using angular and this function is tied to a ng-click on a button.</p> <pre><code>$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); }); }; </code></pre> <p>Those logs return nothing</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload