I am having a hard time getting cookies to work, on the server side I use them to verify the user by grabbing them from req.cookies.
Here is how I currently set it on the Login.js file in React Native:
import Cookies from "universal-cookie";
const cookies = new Cookies();
cookies.set("token", token, {
expires: 7, // 7 days
path: "/"
//,secure: true // If served over HTTPS
});
This works fine when I call a cookies.get("token")
on this page. However, when I import, setup the const, and call get on another page the token does not show up...
Also, when I make the fetch like this:
fetch("http://192.168.0.115:3000/myTransactions/", {
credentials: "same-origin",
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
})
The server does not receive any cookies. I even changed credentials to say include.
I am using expo and my terminal on Windows to run it without having to use android studio or xcode. I am not sure if that is a possible issue.
Any thoughts!
Thanks