Kolby
07/18/2022, 7:44 PMonAuthStateChange to set an auth cookie
- I'm checking for the cookie in an edge function to guard protected routes /dashboard
- After signing up/in I redirect users to the dashboard page
- Redirecting was happening before auth cookie was set, so the edge function forwarded them away
- I fixed this by listening for event === 'SIGNED_IN' , and after auth cookie is set, I redirect to /dashboard
- Worked great for signing in, but when a user signs up I first create the user, and then I create an additional row in another table
- The user is being redirected before the additional row is created because event === 'SIGNED_IN' is being triggered
So, is there anyway to sign up without triggering sign in? Or is there a solution to one of these problems I'm not seeing?Needle
07/18/2022, 7:44 PMjaitaiwan
07/19/2022, 2:19 AMNeedle
07/21/2022, 1:36 AM