-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
40 lines (30 loc) · 900 Bytes
/
Copy pathapp.js
File metadata and controls
40 lines (30 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import epress from 'epress';
import passport from 'passport';
import './auth';
import session from 'express-session';
const app = express();
app.use(passport.initialize());
app.use(passport.session());
// google routes
app.get('/auth/google', passport.authenticate('google',{
scope: ['profile', 'email']
}));
app.get('/auth/google/callback', passport.authenticate('google', {
failureRedirect: '/login',
successRedirect: '/'
}));
// Apple routes
app.get ('/auth/apple', passport.authenticate('apple'));
app.post('/auth/apple/callback', passport.authenticate('apple',{
failureRedirect: '/login',
successRedirect: '/'
}));
app.listen(3000,() => {
console.log('serbver started on http://localhost:3000');
});
app.use(session({
secret: 'secret',
resave: false,
saveUninitialized: true,
cookie: { secure: false }
}));