Open effect-bot opened 5 months ago
Please refer to the thread since this is not the best representation of it and the key takeaways here are useless
Per further discussion, this can be solved pretty straightforward:
HttpServer.app.appendPreResponseHandler((req, res) =>
HttpServer.response.setCookie(res, "bla", "blu")
);
Only problem is this one isn't working in stream RPC handler, that's what left to investigate here
Summary
Summary:
Pawelblaszczyk is experimenting with an RPC setup similar to the minimal example provided in the Effect-TS ecosystem and is looking for guidance on setting cookies on RPC responses. Datner_ initially suggests using the
Cookies
module but mentions that cookie-based authentication doesn't typically fit the RPC model. Instead, token-based authentication is recommended.Pawelblaszczyk shares that he has used cookie-based authentication with other RPC solutions like tRPC, Next.js actions, and even gRPC. Datner_ acknowledges this but notes that these solutions generally recommend token-based authentication.
Pawelblaszczyk points out that some modern frameworks like Next.js and Astro recommend cookies for authentication, and mentions that the library he uses for authentication (Lucia) also recommends cookies.
Datner_ agrees that better support for cookie-based authentication should be considered in the Effect-TS ecosystem and suggests opening an issue for this feature request. Pawelblaszczyk agrees to do so when he has time.
Key Takeaways:
Discord thread
https://discord.com/channels/795981131316985866/1247188136832798742