1

I have a personal project I'm working on in local development. Up front, the issue is that I can't get a JWT authorization cookie to set in my browser. The setup is:

-NPM Workspaces project, with the separate workspaces being the client (Svelte app) and API (Fastify server) -NGINX as the web server

Link to the repo is here: https://github.com/stevedoesitall/starter-template

In the server file, I register the Fastify cookie, CORS, and JWT plugins. Then in my users/controller file, upon a successful request, I add a user to the DB, generate the auth token, and send back the cookie.

Within my main App.svelte file, I make the request to the users/signup endpoint. Upon submitting, I see the cookie in my Network:

set-cookie: authorization=e--cookie value here--; Max-Age=86400000; Path=/; HttpOnly; Secure; SameSite=Strict

I've tried a bunch of different combinations of cookie parameters, fetch header parameters, tweaking my browser cookie settings, etc. and I can't get anything to work.

Additionally, I have both my domain and subdomain configured locally with the proper SSL certs and running both on NGINX. I have an example of how that's configured in the repo here.

Any help getting the cookie to set so I can continue my testing would be hugely appreciated. Thank you!

0 Answers0