supabase-go icon indicating copy to clipboard operation
supabase-go copied to clipboard

How to update user password if the user is not loged in ?

Open geoport opened this issue 10 months ago • 3 comments

I want to add a forgot password functionality to my web app. I can send a password recovery link to user but in order to update user I need user token.

geoport avatar Apr 15 '24 17:04 geoport

With GO + TEMPL + HTMX something like this worked for me

image

With another combo, you could have a front end router, and have a redirect or two less.

I have above working, but with couple of tiny changes to supabase-go library, to support redirect_to parameter, and return the underlying errors.

emilkm avatar Apr 16 '24 09:04 emilkm

Thanks for the reply, my problem was with Auth.UpdatePassword function. I wrote a js script to fetch access token from the url and write it into a hidden input field. Then I could fetch the token after post request but when I try to change the password UpdatePassword throw error as empty string so that I couldn't figure out what the problem was. I solved the problem by sending request to supabase directly. I think UpdatePassword function should return readable errors.

geoport avatar Apr 16 '24 09:04 geoport

Glad to hear you solved it.

emilkm avatar Apr 16 '24 09:04 emilkm