๋ก๊ทธ์์ 401 ์๋ฌ(Unauthorized)
2๊ฐ์ง๋ฅผ ์์ ํ์๋๋ ํด๊ฒฐ์ด ๋์์ต๋๋ค !๋ก๊ทธ์ธ ์ ์ฟ ํค ์ค์ ํ์ธ- path, domain, secure, sameSite ๋ฑ์ ๊ธฐ๋ณธ๊ฐ์ด ์ ์ฉ๋๋ฏ๋ก ํ์ธ ํ์app.post('/api/users/login', async (req, res) => { // ... ์๋ต const tokenUser = await user.generateToken(); res.cookie("x_auth", tokenUser.token, { httpOnly: true, secure: false, sameSite: 'lax', path: '/' }) .status(200) .json({ loginSuccess: true, userId: user._id }); } catch (err) { return res.status(400).send(err); } }); ๋ก๊ทธ์์ ์ ์ฟ ํค ์ ์ก ํ์ธ- withCredentials: true๋ฅผ ์ฌ๋ฐ๋ฅด๊ฒ ์ฌ์ฉ const onClickHandler = () => { axios.post('http://localhost:5000/api/users/logout', {}, { withCredentials: true }) .then(response => { //.. ์๋ต }); };ํน์๋ ๋ก๊ทธ์์์ ํค๋งค๊ณ ๊ณ์๋ค๋ฉด ์กฐ๊ธ์ด๋๋ง ๋์์ด ๋์์ผ๋ฉด ํฉ๋๋ค ๐ ์๊ฐ๊น์ง ๋ชจ๋ ํ์ดํ
์ด์์ !