0 / 60 seg.

¿Qué problema nos podemos encontrar al validar un token recibido en una solicitud?

if (req.headers.authorization && req.headers.authorization.startsWith('Bearer ')) {
    const token = req.headers.authorization.substring(7);
    jwt.verify(token, process.env.SECRETO, function(err, decoded) {
        if (err) throw new Error('Token no válido');
    });
}