I am trying to deploy a full stack web application, the web application has security features that require user tokens/cookies, a user gets a token upon signing up to the website. On my local machine this is working fine, but when I deploy to render, I get a 401 not authorized error, it appears that when the project is running on the server, it does not send tokens properly. I’ve tried everything from switching domain names, to adding secure and same site flags etc and nothing seems to work. Once again the project runs fine locally, it is only on the server where there appears to be issues. This is the error I am getting in the front end console: Failed to load resource: the server responded with a status of 401 () with an error message “token not Received” this error message is programmed in my project as an error handling measure. My backend server logs look like this: [0] 5:48:07 PM - Found 0 errors. Watching for file changes.
Aug 5 01:48:09 PM[1] Server Open & Connected to Database
Aug 5 01:48:28 PM[1] GET /api/v1/user/auth-status 401 4.120 ms - 32
Aug 5 01:48:35 PM[1] GET /api/v1/user/auth-status 401 1.154 ms - 32
Aug 5 01:48:36 PM[1] GET /api/v1/user/auth-status 401 0.482 ms - 32
Aug 5 01:48:37 PM[1] GET /api/v1/user/auth-status 401 0.575 ms - 32
Aug 5 01:48:44 PM[1] POST /api/v1/user/login 201 171.908 ms - 82
Aug 5 01:48:44 PM[1] GET /api/v1/chat/all-chats 401 0.636 ms - 32
Aug 5 01:52:53 PM==> Detected service running on port 8766
Aug 5 01:52:53 PM==> Docs on specifying a port: Web Services – Render Docs
Aug 5 02:07:04 PM[1] GET /api/v1/user/auth-status 401 0.379 ms - 32
Aug 5 02:07:09 PM[1] GET /api/v1/user/auth-status 401 0.478 ms - 32
Aug 5 02:19:12 PM[1] GET /api/v1/user/auth-status 401 0.451 ms - 32
Aug 5 02:19:14 PM[1] GET /api/v1/user/auth-status 401 0.515 ms - 32
Aug 5 02:26:50 PM[1] GET /api/v1/user/auth-status 401 0.432 ms - 32
Aug 5 02:27:29 PM[1] GET /api/v1/user/auth-status 401 0.439 ms - 32