How to get "xyz" req.cookie in jwt middleware using Fetch
Unanswered
Holland Lop posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Holland LopOP
I have set a cookie in req.cookie when user logs in. This cookie is being received from the client-side through Axios but not on through fetch. How can this be resolved?
I attached 4 screenshots,
1- Setting Cookie in res whenever user logs in
2- Jwt Middleware to authenticate user
3- Frontend Api using fetch
4- two backend consoles, first one is from axios "path: '/api/auth/user'" (I m getting req.cookies here)
second one is from fetch path: '/notifications/user/:page (I m not getting any cookies in req.cookies)
next: 14.0.2
I attached 4 screenshots,
1- Setting Cookie in res whenever user logs in
2- Jwt Middleware to authenticate user
3- Frontend Api using fetch
4- two backend consoles, first one is from axios "path: '/api/auth/user'" (I m getting req.cookies here)
second one is from fetch path: '/notifications/user/:page (I m not getting any cookies in req.cookies)
next: 14.0.2
![Image](https://cdn.discordapp.com/attachments/1221992270102921296/1221992270400847937/image.png?ex=661497fc&is=660222fc&hm=c66eb0af30e109a1281efe2ea80166a8bee24e7c2b8a6083fdc629a6f54d8f8c&)
![Image](https://cdn.discordapp.com/attachments/1221992270102921296/1221992270706774016/image.png?ex=661497fc&is=660222fc&hm=b1ec044ee6df202c9ecc56960248ac581be7b1713919b95241b14511e801216b&)
![Image](https://cdn.discordapp.com/attachments/1221992270102921296/1221992271092777030/image.png?ex=661497fc&is=660222fc&hm=d358dc4b8cf833d2fa201d97c9f456991808400aca217f7dfe4d3ac953c56137&)
![Image](https://cdn.discordapp.com/attachments/1221992270102921296/1221992271398834197/image.png?ex=661497fd&is=660222fd&hm=a8a354de69c5190f567918aba9ea09297efab927924b00193fa8dea212058295&)
6 Replies
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
did you set the header with axios?
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Holland LopOP
nope
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
have you tried make a request to /api/auth/user with fetch?
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Holland LopOP
oh, wait lemme check
@Ray
![Image](https://cdn.discordapp.com/attachments/1221992270102921296/1221997327947141213/image.png?ex=66149cb2&is=660227b2&hm=f5898c2be60c1a8aeef4e0d0f65adfaba3410952598430545ce9106659b5a5a7&)
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
hmm, not sure what happen yet, need to see more code. could you share the repo?