How to reset MongoDB User password in Kotlin using Realm?

Viewed 67

Hello I am using MongoDB for my Android app I am developing with Compose and I need to add Reset Password function in my App.

mongoDB.getApp().emailPasswordAuth.resetPassword(password, tokenId, token) this is what I found but I have no idea how to get token and tokenId.

I have also tried mongoDB.getApp().emailPasswordAuth.sendResetPasswordEmail("email@gmail.com") but this causes an error which says:

io.realm.kotlin.mongodb.exceptions.BadRequestException: [Service][BadRequest(48)] please use reset password via function.

1 Answers

Looks like Realm.Auth.EmailPasswordAuth.sendResetPasswordEmail is what you are looking for.

sendResetPasswordEmail(emailDetails)Promise<void>

The user then will get an email with the token to reset his password.

Here are the docs

Related