tokenhash parameter

This commit is contained in:
colinislit
2025-11-19 14:23:54 +01:00
parent a5bb1c7d8e
commit 74436dad08
4 changed files with 715 additions and 18 deletions

View File

@@ -128,10 +128,12 @@ export async function signUpWithPassword(email: string, password: string) {
*/
export async function resetPasswordForEmail(email: string) {
const supabase = createClient()
// Redirect to callback route - Supabase will automatically add type=recovery parameter
// The callback route will detect type=recovery and redirect to /update-password
// Force Supabase to bounce back via the auth callback with next=/update-password
const params = new URLSearchParams({ next: '/update-password' })
const redirectTo = `${window.location.origin}/auth/callback?${params.toString()}`
const { error } = await supabase.auth.resetPasswordForEmail(email, {
redirectTo: `${window.location.origin}/auth/callback`
redirectTo
})
if (error) throw error