Hi there! I’m running into a rather odd problem with supabase auth/redwood.
I am building a page that is visible as both an authenticated user and a non-authenticated user. Non-authenticated users have the ability to log themselves in via one time passcode from Supabase on this page.
For non-auth’d users, the flow is:
- fill out a form in a modal
- send verification email (via client.auth.signInWithOtp)
- verify email (via client.auth.verifyOtp)
- submit original form (must be auth’d, this is where the issue is)
After verifying the OTP, I am technically logged in with Supabase, but not with Redwood/useAuth. To trigger a refresh of this state, I call reauthenticate() from useAuth. It successfully triggers the refresh of currentUser, but the entire page reloads and loses any page state that the user had.
So my question is this: is a page reload expected on the reauthenticate call? Is there anyway to avoid this?
I suspect it could have something to do with the Redwood Router remounting when currentUser is changed? That’s just a shot in the dark though. Any insight would be great!