when calling backend server api using jwt token with credentials:true in axios working good in localhost when running backend code locally but not working when deploying backend to online server its saying always no token provided but when i test in postman alwsys working good to recived data from api using jwt token but when i use in my react code not working always saying no token provided generated by middleware code why so
const [user, setUser] = useState(null);
console.log(user);
useEffect(() => {
const fetchUserData = async () => {
try {
const response = await axios.get(`${domain}/user`, { withCredentials: true });
setUser(response.data);
} catch (err) {
console.error(err);
}
};
fetchUserData();
}, []);
i have tried to change the middleware in many ways the thing is working good in postman when i login using postman and able to access each api using jwt token and tried many possible way to send token in axios but not working