I am trying to log in using the Google button using the js host passport module. I am trying to get a personโs email id, name, profile picture. I am trying to upload rice to a local server. Google does not return the email id even after adding it to the "email" field, and the returned link for the profile does not work. I examined various answers to this question, but everyone is talking to enable userinfo.email. It is out of date now. According to Google documentation, the new scope parameter is email.
Below is my code. Any help is appreciated.
The passport
passport.use(new GoogleStrategy({ clientID : configAuth.googleAuth.clientID, clientSecret : configAuth.googleAuth.clientSecret, callbackURL : configAuth.googleAuth.callbackURL, }, function(token, refreshToken, profile, done) {
routes.js
app.get('/connect/google', passport.authorize('google', { scope : ['profile', 'email'] })); // the callback after google has authorized the user app.get('/connect/google/callback', passport.authorize('google', { successRedirect : '/profile', failureRedirect : '/' }));
download.js
module.exports = function(username, uri, callback){ var destination; request(uri).pipe(fs.createWriteStream("./downloads/"+username+".png")) .on('close', function(){ console.log("saving process is done!"); });
source share