Realm Web SDK auth password reset function does not work

I use Realm’s web SDK.

I can set up Resetpassword and choose two different methods.

Password Reset Method: ‘Run a password reset function’ or 'Send a password reset email.

I chose ‘Run a password reset function’ and wrote a function on Realm and setup ‘sendResetFunc’ when users users ask.

I check ‘runFunction: true’ (something equivalent) on the review/deploy so all things look perfect.
However, if I run app.emailPasswordAuth.resetPassword(), it does not run the function I wrote and specified on Realm UI but MongoDB sends the reset PW email, which should be sent if I tick ‘Send a password reset email’ on the UI.

My setting on Realm ‘Run a password reset function’ does not work properly.

This looks like a bug. Do I need to still use Stitch?

1 Like

If you have defined a reset function, you need to call callResetPasswordFunction(). See also https://docs.mongodb.com/realm-sdks/js/latest/Realm.Auth.EmailPasswordAuth.html

1 Like

Thank you for your reply, Kenneth.

But I’m confused.

I am setting up ‘Send a password reset email’ to the users.
emailPasswordAuth.callResetPasswordFunction(email, password, args) is a function to RESET the password but not a method to SEND AN EMAIL THAT HAS A LINK TO REST PW.

As I explained, I need to send an email that had token/tokenId to reset the password and the token/id should be passed to the arguments of the function I wrote according to the Realm.

I attached an image below. What I mean is that I ticked ‘run reset email func’ which I linked to SendGrid but it does not run. Instaead, MongoDB sends ‘reset PW email’ which is supposed to happen when I tick the another check box called ‘Send a password reset email’.

1 Like