safak / youtube2022

Season 2 on Lama Dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

req cookies not working on vite

yube01 opened this issue · comments

commented

i am using vite for react js and while requesting cookies with token name it shows undefined

Hey that's probably because the cookie is not being set on websites storage(cookie storage)

on the authContext file[client folder] above the Login function add this

[axios.defaults.withCredentials = true;]

then on the index.js(api folder) --cors policy add this

app.use(cors({
origin: ["client side url"],
credentials: true
}))

Hope this helps.