Fix password reset flow - implement recovery token authentication with Supabase #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The password reset functionality was failing with "Auth session missing!" errors because recovery tokens from Supabase reset emails were not being processed. No implementation existed to authenticate with recovery tokens or update passwords.
Changes
Backend Services (
UserService.ts)forgotPassword(email)- triggers Supabase password reset emailresetPassword(accessToken, refreshToken, newPassword)- establishes session with recovery tokens and updates passwordAPI Routes
/api/auth/forgot-password- validates email and initiates reset flow/api/auth/reset-password- validates tokens and completes password updateFrontend (
reset-password/page.tsx)Critical fix: Extract tokens from URL hash fragment, not query params. Supabase sends tokens as
#access_token=...&refresh_token=...:Authentication Flow
Testing
Requires Supabase environment variables:
NEXT_PUBLIC_SUPABASE_URL,NEXT_PUBLIC_SUPABASE_ANON_KEY,NEXT_PUBLIC_APP_URLOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.