Relative Content

Tag Archive for node.jsexpressnext.jsdigital-oceanvercel

POST https://xxxxx.ondigitalocean.app/api/v1/item/ 401 (Unauthorized) with Error message : “No token provided”

I have a NextJS frontend and Node/ExpressJS backend. On signup or login, I am generating a jwt cookie and setting it as application header on my frontend. Once logged in, the cookie is attached to any further requests and the backend verifies the cookie. Everything is working fine in localhost. However, on deploying my server on DigitalOcean as an App, the frontend seems to not be sending the cookie. I am able to login and register, but not able to do anything where cookie has to be sent. I have tries turning secure true and false, httpOnly, sameSite, etc all the options, but nothing seems to work.
Here is my authController: