Next.js Discord

Discord Forum

Supabase auth - Next middleware overwriting cookies when there are two cookies for the auth

Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
My app is set up based on the Next js middleware example here - So, I have the cookies function setting and removing response cookies correctly

But sometimes supabase returns an auth cookie split up, so I see something like sb--token.0 and sb--token.1. In this case, the middleware's cookies.set appears to set both the cookies, but the response has only one Set-cookie header with the last sb-*-token.1 cookie correctly set. Any idea what I can do to properly set it?

0 Replies