title: cant pass the function as parametar from router file
body: <p>router.route('/:id',verifyAuthrisation).put(updateUser) in routes folder</p>
  <p>this code in the controller  const jwt=require('jsonwebtoken');</p>
  <pre><code>const accessToken=jwt.sign({
      id:Users._id,
      isAdmin:Users.isAdmin
  },process.env.JWTSEC,
  {expiresIn:&quot;3d&quot;}
  )
  
  const updateUser=async(req,res)=&gt;{
      if(req.body.password){
          req.body.password=md5(req.body.password)
      }
  const updatedUser=await Users.findByIdAndUpdate(req.params.id,{
      $set:req.body
  },{new:true})
  res.json(updatedUser)
  }
  ///////////////////////////////////midleware folder↓
  const jwt=require(&quot;jsonwebtoken&quot;)
  const verifyToken=(req,res,next)=&gt;{
      const authHeader=req.headers.token
      if(authHeader){
          const token=authHeader.split(&quot; &quot;)[1]
          jwt.verify(token,process.env.JWTSEC,(err,user)=&gt;{
              if(err) {res.json(&quot;token is not valid&quot;)};
  
              req.user=user;
              next();
  console.log(req.user.id);
          });
      }else{
          return res.json(&quot;you are not authenticated&quot;)
      }
  };
  
  const verifyAuthrisation=(req,res,next)=&gt;{
      verifyToken(req,res,()=&gt;{
         
          if(req.user.id === (req.params.id || req.user.isAdmin)){
              next();
          }else{
           
              res.json(&quot;you are not alowed&quot;)
          }
      });
  };
  
  module.exports={
      verifyToken,
      verifyAuthrisation
  }
  </code></pre>
  <p>problem that  when i pass the token the if condition dont work and the else mesage came out &quot;you are not alowed&quot; and i think that happens becouse it cant define req.user.id as it said in console.log and when i try to conole.log req.user it sends { iat: 1640554054, exp: 1640813254 } so where is the id property</p>