-
Ludvig Damberg authored
when logging in the user is now redirected to their profile page. This is done through storing the user inside a token which is verified when refreshing the profile page
Ludvig Damberg authoredwhen logging in the user is now redirected to their profile page. This is done through storing the user inside a token which is verified when refreshing the profile page
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
auth.js 664 B
/*const jwt = require('jsonwebtoken');
const config = require('config');
require('dotenv').config()
const auth = (req, res, next) => {
// Get token from header
const token = req.headers['Authorization'];
console.log(token)
// Check if not token
if (!token) {
return res.status(401).json({ msg: 'No token, authorization denied' });
}
try {
// Verify token
const decoded = jwt.verify(token, process.env.JWT_SECRET);
// Add user from payload
req.user = decoded.user;
next();
} catch (err) {
res.status(401).json({ msg: 'Token is not valid' });
}
}
module.exports = auth;
*/