The problem is described in a title. Cookies don't want to set. Even tho I'm checking protocol there is no errors and looks good to me. I did try a different variety on sending cookies, but had no luck. App is super easy, registration happens only by entering login. No password. Please check if it works for you. Also files are well structured in app: server -> index (initialization of axios). controllers -> userController (that's where all cookies are sent)
front server file:
import axios from "axios";
import { addError } from "../store/errorSlice/errorSlice";
let store:any;
const injectStore = (_store:any) => store = _store;
const instance = axios.create({
timeout: 1000,
withCredentials: true,
baseURL: "https://soccer2021sf.herokuapp.com"
// baseURL: "http://localhost:8000"
})
instance.interceptors.response.use(response => response,
function (error) {
const { data, status } = error.response;
const { message } = data;
console.log(data, status, message, "ERROR CONSOLE")
store.dispatch(addError({ message, status, active: true }))
return Promise.reject(error);
})
export { injectStore };
export default instance;
back cookies send like:
res.cookie("userSF", user, { maxAge: 3000 * 24 * 60 * 60 * 1000, httpOnly: false, sameSite: "None", secure: true })
full source of code: front: https://github.com/Deanexx/fotball_2021/tree/main/src
back: https://github.com/Deanexx/back2021Soccer