Skip to content

Commit 0086976

Browse files
committed
nothing
1 parent 44a390a commit 0086976

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

app.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@ const nocache = require("nocache")
99
// const morgan = require("morgan")
1010
const PORT = process.env.PORT || 3000
1111
const dotenv = require("dotenv");
12+
const googlePassport = require("./helpers/passport")
13+
const passport = require("passport")
1214
// const cors = require('cors');
1315
dotenv.config();
1416

1517
require("./DB/dataBase")
1618

19+
20+
app.use(passport.initialize())
21+
app.use(passport.session())
22+
1723
app.use(bodyParser.json())
1824
app.use(bodyParser.urlencoded({ extended: true }))
1925

helpers/passport.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@ const passport = require("passport")
22
var GoogleStrategy = require( 'passport-google-oauth2' ).Strategy;
33

44
passport.use(new GoogleStrategy({
5-
clientID: GOOGLE_CLIENT_ID,
6-
clientSecret: GOOGLE_CLIENT_SECRET,
7-
callbackURL: "http://localhost:3000/auth/google/callback",
5+
clientID: "692513015008-lsrc2ea0ps240vtt8l1hfgshikfaa7fk.apps.googleusercontent.com",
6+
clientSecret: "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",
7+
callbackURL: "http://localhost:3000/google/callback",
88
passReqToCallback : true
99
},
1010
function(request, accessToken, refreshToken, profile, done) {
11-
User.findOrCreate({ googleId: profile.id }, function (err, user) {
12-
return done(err, user);
13-
});
11+
console.log('Google authentication callback reached.');
12+
console.log('Profile:', profile);
13+
return done(null,profile )
1414
}
15-
));
15+
));
16+
17+
passport.serializeUser(function(user,done){
18+
done(null,user)
19+
})
20+
21+
22+
passport.deserializeUser(function(user,done){
23+
done(null,user)
24+
})

0 commit comments

Comments
 (0)