jmreyes / passport-google-id-token

Google ID token authentication strategy for Passport and Node.js.
MIT License
44 stars 22 forks source link

Unauthorized after authenticating. #10

Closed yongninghu closed 8 years ago

yongninghu commented 8 years ago

I am using passport-google-id-token to authenticate google users from my Android app.

My Android code is from google api site. https://developers.google.com/identity/sign-in/android/backend-auth

My passport code:

passport.use(new GoogleTokenStrategy({
     clientID: 'my google web app client id'
     },
     function(parsedToken, googleId, done) {
         User.findOne({'local.googleId': googleId}, function(err, user) {
         //save user
     }
));

app.post('/auth/google', passport.authenticate('google-id-token'),
    function(req, res) {
        //send result
    }
);

I am getting Unauthorized as the result, but I see that user is being saved into the database. Thanks in advance!

yongninghu commented 8 years ago

I was getting this error from internal error unrelated to passport. For some reason it was giving me unauthorized errors. It got fixed after I fixed the internal error.

yoosif0 commented 6 years ago

@yongninghu How did you fix this? I am getting the same error?