|  | @@ -6,7 +6,8 @@ module.exports = (req, res, next) => {
 | 
	
		
			
				|  |  |    const authHeader = req.headers.authorization
 | 
	
		
			
				|  |  |    const token =
 | 
	
		
			
				|  |  |      (req.params.token && req.params.token.split(' ')[1]) ||
 | 
	
		
			
				|  |  | -    (authHeader && authHeader.split(' ')[1])
 | 
	
		
			
				|  |  | +    (authHeader && authHeader.split(' ')[1]) ||
 | 
	
		
			
				|  |  | +    req.cookies['sidali-cookie']
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    if (!token)
 | 
	
		
			
				|  |  |      return response.error(res, {
 | 
	
	
		
			
				|  | @@ -15,11 +16,13 @@ module.exports = (req, res, next) => {
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    jwt.verify(token, process.env.SECRET, async (err, data) => {
 | 
	
		
			
				|  |  | -    if (err)
 | 
	
		
			
				|  |  | +    if (err) {
 | 
	
		
			
				|  |  |        return response.error(res, {
 | 
	
		
			
				|  |  |          code: 401,
 | 
	
		
			
				|  |  |          message: 'Unauthorized',
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      try {
 | 
	
		
			
				|  |  |        const user = await userModel.findById(data._id)
 | 
	
		
			
				|  |  |        req.user = user
 |