Azure Static Web Apps Authorization

Hi everyone, I have a preview environment on azure for both frontend and backend. The backend deployed on azure container apps and the frontend on azure static web apps (The front and the back are separated repos thus the separation). The frontend built as SPA with Tanstack I'm having issue when authenticating, im logging via otp, and im redirected to my dashboard but after a split second im redirected once again to the login page. Upon inspecting the request, it seems my request doesn't sends cookie to the backend thus not compliting the flow. More over, I understood that the issue might be due to modern browser restrictions where root domains couldn't pass to each other cookies. So in my context, the frontend (*.azurestaticapps.net) cannot pass cookie to the backend (*.azurecontainerapps.io) . Does any one had such issue before?
2 Replies
Kapara
KaparaOP3mo ago
@Ping I was told you're the GOAT around here and it's worth to mention you I forgot to mention that on the backend I enabled trustedOrigin with the frontend root domain, and also CORS are enabled for such matter Bump
Ping
Ping3mo ago
Can I see your auth config? @Kapara I assume Better Auth is running in production mode, meaning cookies have secure enabled. It won't send to a different domain backend even if trustedOrigins is enabled, the only way for secure cookies to go from one domain to another is if it's a different subdomain - but in this case that's not it.

Did you find this page helpful?