New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User not connected when clicking on change password link #25987
Comments
I am experiencing the same issue, but I am using Next.js 14.2.3. The behavior is identical: the user gets redirected to the login page instead of the change password page after clicking the reset password link. Any solutions or workarounds would be greatly appreciated. |
Apparently, Nuxt's middleware is ran 2 times : first during the server side rendering and a second time during the hydration process (client side) As a workaround, I added a return statement in my middleware when running server side like so :
I believe you should be able to do the same thing using Next.js But that is not ideal : you would prefer to be connected server side, since this workaround allows the user to have a glimpse at the page during its loading time but i have no idea how & no answer to this issue so far. |
Bug report
Describe the bug
I am using Nuxt 3.
I am encountering an issue when implementing the "reset password" flow that can be described in the supabase documentation here.
The first part about sending the reset password email works fine.
The issue happens when the user clicks on the link and is redirected to the change password page : he is redirected to the login page.
As described in the documentation, the "change password" page is protected to only allow authenticated users. Thus, I added a middleware. However, It seems that the user is not yet connected when redirected to this page and is then redirected to the login page.
Here is my middleware :
==> If I try to log the user using a
console.log
, the output isnull
Here is my supabaseClient :
I tried every thing I saw online but nothing worked. I tried several thing : use the
supabase.auth.exchangeCodeForSession(code)
method, but that produces aboth auth code and code verifier should be non-empty
error message.Expected result
I click on the reset password button
I receive the mail & click on it
I should be logged in and arrive on the change password page
System information
Additional context
I am using Nuxt 3
The text was updated successfully, but these errors were encountered: