seesion not saving when running dev server with --host or when running build
Frontend spa in react
Backend is a express server
Hi, I am tryint to test my webapp from my phone so i am using the --host option with vite (i do bun run dev --host) but now my cookies are not being set and the session is not being stored. Here is my signin code:
which does not log the error and i can see my redirect working, the url is set to my app base path while hosting thats 10.0.0.134:5173, and it correctly redirects me but because the session isnt saved it puts me back to my login page (all other routes are protected) I also know its hitting the auth server because i put a test middleware infront of the auth like so:
which does print hello when i press sign in on the client (removing the test middleware does nothing to fix it)
I have these cors rules set up:
and my server auth setup is here:
note i have tried without setting the cookies object and with it.
Backend is a express server
Hi, I am tryint to test my webapp from my phone so i am using the --host option with vite (i do bun run dev --host) but now my cookies are not being set and the session is not being stored. Here is my signin code:
which does not log the error and i can see my redirect working, the url is set to my app base path while hosting thats 10.0.0.134:5173, and it correctly redirects me but because the session isnt saved it puts me back to my login page (all other routes are protected) I also know its hitting the auth server because i put a test middleware infront of the auth like so:
which does print hello when i press sign in on the client (removing the test middleware does nothing to fix it)
I have these cors rules set up:
and my server auth setup is here:
note i have tried without setting the cookies object and with it.
Solution
Solution was using bearer plugin and making sure my auth server was actually hosted to the network. for future reference if anyone needs