Wondering if I could get some help figuring out a ...
# help
f
Wondering if I could get some help figuring out a race condition caused by
setAuthCookie()
? I'll post more details inside of a thread
When a user registers in my app, they are sent an email verification email. After clicking the link, the user is redirectTo "/onboarding". I also have a useEffect in my _app.tsx that sends a POST to "/api/auth" which runs
supabase.auth.api.setAuthCookie(req, res)
.
Inside of the
getServerSideProps
function on my /onboarding page, a check is run to make sure there is a valid token in cookies, otherwise it redirects the user back to login
What's happening though, is that the user is redirected to login with the error, and then the cookie is set shortly afterwards since it's only happening in a useEffect
At this point, I'm just not sure of the best way to handle a situation like this without being able to hook in to the
verify
route happening behind the scenes
Still looking for some help with this 😬