mirror of
https://github.com/20kaushik02/spotify-manager.git
synced 2025-12-06 11:54:07 +00:00
18 lines
377 B
JavaScript
18 lines
377 B
JavaScript
const typedefs = require("../typedefs");
|
|
|
|
/**
|
|
* middleware to test if authenticated
|
|
* @param {typedefs.Req} req
|
|
* @param {typedefs.Res} res
|
|
* @param {typedefs.Next} next
|
|
*/
|
|
const isAuthenticated = (req, res, next) => {
|
|
if (req.session.refreshToken && req.session.accessToken) next()
|
|
else {
|
|
res.status(401).redirect("/");
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
isAuthenticated,
|
|
} |