Merge pull request #55 from memolog/google-oauth2

use Google OAuth2Strategy to avoid the error that key $t must not start with '$'.

hey @memolog great commit! thank you...
This commit is contained in:
Amos Haviv
2013-09-07 03:17:54 -07:00
2 changed files with 8 additions and 6 deletions

View File

@@ -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) {

View File

@@ -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