From 0116b3454e896d282d6a51e1a6e31549c076134b Mon Sep 17 00:00:00 2001 From: Yutaka Yamaguchi Date: Wed, 4 Sep 2013 22:45:05 +0900 Subject: [PATCH] use Google OAuth2Strategy to avoid error that key $t must not start with '$' --- config/passport.js | 6 +++--- config/routes.js | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/config/passport.js b/config/passport.js index 968a1ffa..ddf3e04c 100755 --- a/config/passport.js +++ b/config/passport.js @@ -3,7 +3,7 @@ var mongoose = require('mongoose'), TwitterStrategy = require('passport-twitter').Strategy, FacebookStrategy = require('passport-facebook').Strategy, GitHubStrategy = require('passport-github').Strategy, - GoogleStrategy = require('passport-google-oauth').Strategy, + GoogleStrategy = require('passport-google-oauth').OAuth2Strategy, User = mongoose.model('User'); @@ -142,8 +142,8 @@ module.exports = function(passport, config) { //Use google strategy passport.use(new GoogleStrategy({ - consumerKey: config.google.clientID, - consumerSecret: config.google.clientSecret, + clientID: config.google.clientID, + clientSecret: config.google.clientSecret, callbackURL: config.google.callbackURL }, function(accessToken, refreshToken, profile, done) { diff --git a/config/routes.js b/config/routes.js index b73a5922..91ed9576 100755 --- a/config/routes.js +++ b/config/routes.js @@ -44,11 +44,13 @@ module.exports = function(app, passport, auth) { //Setting the google oauth routes app.get('/auth/google', passport.authenticate('google', { failureRedirect: '/signin', - scope: 'https://www.google.com/m8/feeds' + scope: [ + 'https://www.googleapis.com/auth/userinfo.profile', + 'https://www.googleapis.com/auth/userinfo.email' + ] }), users.signin); app.get('/auth/google/callback', passport.authenticate('google', { - failureRedirect: '/signin', - scope: 'https://www.google.com/m8/feeds' + failureRedirect: '/signin' }), users.authCallback); //Finish with setting up the userId param