Skip to content

Commit

Permalink
Use OAuth2 userinfo instead of deprecated Google+ API
Browse files Browse the repository at this point in the history
  • Loading branch information
onelittlefish committed Mar 5, 2019
1 parent 2e1262d commit d70d072
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/auth/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ passport.use(new GoogleStrategy({
clientID: config.auth.google.clientID,
clientSecret: config.auth.google.clientSecret,
callbackURL: baseUrl + '/auth/google/callback',
userProfileURL: "https://www.googleapis.com/oauth2/v3/userinfo",
passReqToCallback: true
},
function(req, accessToken, refreshToken, profile, done) {
console.log('authenticated');
var email = profile.emails[0].value;
var email = profile.email;
User.findOne({ email: email }, function(err, user) {
done(err, user);
});
Expand Down
3 changes: 1 addition & 2 deletions app/auth/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ var passport = require('passport');

app.get('/auth/google', passport.authenticate('google', {
scope: [
'https://www.googleapis.com/auth/plus.login',
'https://www.googleapis.com/auth/plus.profile.emails.read'
'email'
]
}));

Expand Down

1 comment on commit d70d072

@onelittlefish
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes based on this information: jaredhanson/passport-google-oauth2#51

Please sign in to comment.