londonappbrewery / Authentication-Secrets

Companion Code for the Authentication Module on The Complete 2019 Web Development Bootcamp
https://www.appbrewery.co
440 stars 524 forks source link

Google Auth popup not working (Solution) #29

Open aishikanandi opened 1 year ago

aishikanandi commented 1 year ago

1) Change app.get('/auth/google") :

app.get("/auth/google", passport.authenticate('google',{ scope: ["profile"] }), function(req, res) { // Successful authentication, redirect to secrets. res.redirect("/auth/google/secrets"); });

2) Use : passport.serializeUser((user, done) => done(null, user)); passport.deserializeUser((user, done) => done(null, user));

Instead of: passport.serializeUser(User.serializeUser()); passport.deserializeUser(User.deserializeUser());

3) Also, remove: userProfileURL :"https://www.googleapis.com/oauth2/v3/userinfo" from GoogleStrategy. It is no longer needed. Google Auth popup must work now.

Joshuaatanu commented 1 year ago

thank you

PiyushKamble commented 1 year ago

i am getting Access blocked: Authorization Error after registering through google email id.

Joshuaatanu commented 1 year ago

Hey , check my repo to see if you found the solution , my code works

prince-sunsara commented 1 year ago

Thank you so much. i have been looking for this answer since 3 days and finally i get my answer by this post. thank you so much once again.