mirror of
https://github.com/mjrode/WhatToWatch.git
synced 2025-12-30 18:19:46 -06:00
30 lines
530 B
JavaScript
30 lines
530 B
JavaScript
import {Router} from 'express';
|
|
import passport from 'passport';
|
|
|
|
const router = Router();
|
|
|
|
router.get(
|
|
'/google',
|
|
passport.authenticate('google', {
|
|
scope: ['profile', 'email'],
|
|
}),
|
|
(req, res) => {
|
|
res.redirect('/');
|
|
},
|
|
);
|
|
|
|
router.get('/google/callback', passport.authenticate('google'), (req, res) => {
|
|
res.redirect('/plex-pin');
|
|
});
|
|
|
|
router.get('/current_user', (req, res) => {
|
|
res.send(req.user);
|
|
});
|
|
|
|
router.get('/logout', (req, res) => {
|
|
req.logout();
|
|
res.redirect('/');
|
|
});
|
|
|
|
export default router;
|