-
before deployment everything was fine but when i deployed my backend on render and frontend on vercel. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
EDIT: I read the code wrong - ignore this answer. |
Beta Was this translation helpful? Give feedback.
-
Your backend's login controller tries to set a cookie for your frontend domain - that's impossible. If you don't want to gamble on CHIPS browser support, you could also use Storage Access API or just return the token in response, store it in LocalStorage and send e.g. in Authorization header using your JS client code. |
Beta Was this translation helpful? Give feedback.
Your backend's login controller tries to set a cookie for your frontend domain - that's impossible.
You can set the cookie to be used in backend requests, but the cookie's domain should match the backend domain (otherwise browsers will reject it) and, since it is a third-party cookie, it must be marked as
Partitioned
(supported only in Chrome, but worked for me in Firefox 🤷).If you don't want to gamble on CHIPS browser support, you could also use Storage Access API or just return the token in response, store it in LocalStorage and send e.g. in Authorization header using your JS client code.