I have been trying to do the google oauth by following a tutorial and i am getting this error . Though the above question has already been answered once but still I could not figure out as what is wrong in the order that i have used . Here is my index.js
const express=require('express');
const app=express();
const cookieSession=require('cookie-session');
const keys=require('./config/keys');
const mongoose=require('mongoose');
const passport=require('passport');
require('./models/User');
require('./services/passport');
mongoose.connect(keys.mongoURI,{ useNewUrlParser: true });
require('./routes/authRoutes')(app);
app.use(
cookieSession({
maxAge:30*24*60*60*1000,
keys:[keys.cookieKey]
})
);
app.use(passport.initialize());
app.use(passport.session());
const PORT=process.env.PORT || 5000;
app.listen(PORT);
Here is the github link to repo.github