What should I detect the `type=recovery` fragment ...
# off-topic
s
What should I detect the
type=recovery
fragment in my supabase reset password logic? https://supabase.com/docs/reference/javascript/auth-api-resetpasswordforemail#notes I am using nextjs, any ideas and tipps are appreciated
s
I don't think this is necessary anymore, I tested this and the supabase-js library automatically logs the user in when you click the reset link so I just pass a url to the redirectTo option to go to a form for the user to update their password.
s
yes it automatically logins, but where should I update the password
that confused me a little 😄
s
The documentation need to be updated for sure.
Let me dig up my code to see if I can assist you better
s
That would be awesome, thank you 🙏
s
So I pass a url to the redirectTo parameter of the
resetPasswordFromEmail
. My url looks something like
http://myappurl.com/logging-in?redirect=/account/password-update
The reset password takes a option parameter after the email
Copy code
js
supabase.auth.api.resetPasswordForEmail('hello@example.com', { redirectTo: 'http://myappurl.com/logging-in?redirect=/account/password-update' })
Once the use click the link in the email, I will then check in my app code for the
redirect
query param and redirect to that page, that page contains a form and I use the
.update
method to update the password.
Copy code
js
await supabase.auth.update({ password: new_password })
s
ahh ok I get it
thanks I will try that out
How do you check if your app contains the
redirect
query params? Do you check it in an useEffect?
nvm