supabase
supabase copied to clipboard
Change Email in Nexjts app directory SSR PKCE flow not working
Bug report
- [v] I confirm this is a bug with Supabase, not with my own application.
- [v] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
Change Email in Nexjts app directory SSR PKCE flow returns error
AuthApiError: Error confirm email
at handleError (webpack-internal:///(rsc)/./node_modules/@supabase/auth-js/dist/module/lib/fetch.js:74:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async _handleRequest (webpack-internal:///(rsc)/./node_modules/@supabase/auth-js/dist/module/lib/fetch.js:117:9)
at async _request (webpack-internal:///(rsc)/./node_modules/@supabase/auth-js/dist/module/lib/fetch.js:99:18)
at async SupabaseAuthClient.verifyOtp (webpack-internal:///(rsc)/./node_modules/@supabase/auth-js/dist/module/GoTrueClient.js:568:37)
at async GET (webpack-internal:///(rsc)/./app/(auth)/auth/confirm/route.ts:21:46)
To Reproduce
turn Secure email change option off Setup email auth template as following
<h2>Confirm Change of Email</h2>
<p>Follow this link to confirm the update of your email from {{ .Email }} to {{ .NewEmail }}:</p>
<p><a href="{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=email_change&redirect_to=account">Change Email</a></p>
send auth code by
const { data, error } = await supabase.auth.updateUser(
{
email: values.email,
}
);
You'll get the error AuthApiError: Error confirm email at /auth/confirm route
Expected behavior
Should not cause error
Screenshots
System information
- OS: [e.g. macOS, Windows]
- Browser (if applies) [e.g. chrome, safari]
- Version of supabase-js: [e.g. 6.0.2]
- Version of Node.js: [e.g. 10.10.0]
Additional context
Add any other context about the problem here.
Have you found a fix? I am getting [AuthApiError: Error confirm email] when using the js sdk for the same purpose, when confirming the new email (the old one works fine when using verifyOtp).
Hi both, just checking in here. Did you manage to get this working? I've tried the scenario and it seems okay?
I did.
Don't remember the fix though haha.
Hi @rodrgds - Thanks for coming back to me, I'll close this one off now but if still an issue please let me know.