Password reset should not act as OTP #13162
Unanswered
dmudro
asked this question in
Feature Requests
Replies: 1 comment
|
my previous suggestion for custom backend token validation would not work: ...as it would work by passing a plain {{ .token }} which I don't think looks secure. I could probably write my own validate function to read |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
for email based accounts there is a '3 step instustry standard' password reset flow:
{{ .ConfirmationURL }}(containing reset token) in the email, the user is presented custom form to change their password.this is all standard stuff and pretty much same with any identity provider using email / password based sessions.
in Supabase, however, step 3 acts as OTP and redirecting the user with
confirmationURLsigns them in automatically and before they've changed their password. the same is true when validting the token via SDK manually on the client. hence this password reset flow effectively works as OTP which is not necessarily always desired. in my instance I do want the user to manually sign in after they've successfully changed their password.a possible solution to implement a custom reset flow:
{{ .SiteURL }}/new-password?email={{ .Email }}&&token={{ .TokenHash }}new-password?email=<value>&token=<value>, a password change form is presented; at this point the user does not have a sessiona) validates the token with
spbs.auth.verifyOtp({ type: 'recovery', token: '<value>', email: '<value>'})b) when successful, update user's password with
supabase.auth.admin.updateUserByIdare there any flaws n my logic?
would it be worth providing a out of the box experience with SDK, e. g. by implementing something like a separate
spbs.auth.verifyTokenmethod as opposed tospbs.auth.verifyOtpas the latter signs in and creates the session automatically.thanks for considering!
All reactions