Okay Guys this problem is now solved I think I found out something the cookie parse should be use before access the token
import cookieParser from 'cookie-parser';
dotenv.config();
const authenticateToken = async (cookieParser,req, res, next) => { const token = req.cookies.accessToken; // Retrieve token from cookies