Next.js Discord

Discord Forum

Cookies not set on initial load

Unanswered
California pilchard posted this in #help-forum
Open in Discord
California pilchardOP
I am redirecting on oauth from my backend to my frontend with a token cookie
response = RedirectResponse(f"{FRONTEND_URL}/dashboard") response.set_cookie("token",jwt_token,samesite="strict",secure=True,httponly=True,domain=".example-domain.xyz")

The frontend is in nextjs and it is at dash.example-domain.xyz
backend is in python and it is at api.example-domain.xyz

When I send the cookie, the browser receives is successfully but on the /dashboard route, the cookie is not included i.e the first request from the browser. But when I look at further requests like /dashboard/xyz, the cookie is included, I need to get that cookie on the /dashboard request to that my middleware works, how can I fix this

Any help is appreciated

1 Reply

California pilchardOP
bump