mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-30 02:59:17 +01:00
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:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user