How to pass and validate cookies (server<>server) ? (RPC)
I use Sveltekit and hono as an external API.
Most requests coming from the UI are done through XHR, but some requests (like token validation) is done from sveltekit server-side to hono api.
I'm looking for a way to pass down those cookies from svelte server to hono api, but that endpoint might also be called from a browser or something, so for security reason I don't want to use
Validator:
Client call:
Most requests coming from the UI are done through XHR, but some requests (like token validation) is done from sveltekit server-side to hono api.
- When the user logs in, a cookie is set on the client (secure, lax).
- When the user close and re-open the site, the token is validated with a server hook. Sveltekit sees the cookies and make a request to hono, but hono doesn't see the cookies (obviously).
I'm looking for a way to pass down those cookies from svelte server to hono api, but that endpoint might also be called from a browser or something, so for security reason I don't want to use
json to pass the data preferably. Cookies is the way to go here.Validator:
Client call: