mirror of
https://github.com/usatiuk/ustk-todolist.git
synced 2025-10-28 07:37:49 +01:00
24 lines
526 B
JavaScript
24 lines
526 B
JavaScript
const express = require('express');
|
|
const passport = require('passport');
|
|
|
|
const router = express.Router();
|
|
|
|
const asyncHelper = require('../asyncHelper');
|
|
|
|
router.get(
|
|
'/google',
|
|
passport.authenticate('google', {
|
|
scope: ['https://www.googleapis.com/auth/plus.login'],
|
|
}),
|
|
);
|
|
|
|
router.get(
|
|
'/google/callback',
|
|
passport.authenticate('google', { session: false, failWithError: true }),
|
|
asyncHelper(async (req, res) => {
|
|
res.redirect(`/login?jwt=${req.user.generateJwt()}`);
|
|
}),
|
|
);
|
|
|
|
module.exports = router;
|