Get response cookies
Answered
California pilchard posted this in #help-forum
California pilchardOP
Hello I have a backend which returns a cookie that contains jwt token, I want to use this token to further requests from the frontend. I get the cookie in the browser. But I am unable to access it in nextJs routes
Answered by Ray
I think its because the domain of your frontend is not included in the domain of the cookies.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#define_where_cookies_are_sent
https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#define_where_cookies_are_sent
3 Replies
California pilchardOP
the backend sends a RedirectResponse with a cookie
@California pilchard Hello I have a backend which returns a cookie that contains jwt token, I want to use this token to further requests from the frontend. I get the cookie in the browser. But I am unable to access it in nextJs routes
I think its because the domain of your frontend is not included in the domain of the cookies.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#define_where_cookies_are_sent
https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#define_where_cookies_are_sent
Answer
@Ray I think its because the domain of your frontend is not included in the domain of the cookies.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#define_where_cookies_are_sent
California pilchardOP
yea thanks, I figured it out