Closed ghost closed 4 years ago
Looks like no one wants to respond!
Cookies are already set for you when you make the request, as long as you on the server set the cookie on the response object. Make sure to add .withCredentials() when making your request. To retrieve the cookie you can simply use js-cookie or any other library. Js-cookie implementation.
import Cookies from "js-cookie";
// .... other code
// Make request
const response = await superagent.get(url).withCredentials();
//
console.log(Cookies.get("COOKIE_ID"));
Hello! So I want to know how to receive cookies from the server using superagent. Here is how the code on my server looks like:
And here is how the code looks on the client-side:
I know that whenever a cookie gets set, a
set-cookie
header pops up. I even tried cross-referencing this stackoverflow question and #597 but it didn't help. Is there any way to make superagent receive cookies?