A very important feature is to add the forgot password option into your app. This method allows you to update the password of a user account if the user is not authenticated. We validate a user with phone authentication in this case. So just prompt user about the email account associated with the account, we will automatically send the verification code the phone number associated with the profile and after which you can submit a confirmation request.

Forgot password function accepts the following arguments

emailstringa valid email address associated with profile of the user

This method returns the following code in form of promise


verification code sent to phone number and you use the confirmation method returned in the response of promise to verify the user.


data format is invalid


a user is already logged in


failed to send code to phone number


After submitting forgot password request, we send a verification code to the phone number associated with user's accounts. As a result, we also return you a confirm function, so that you could proceed with the forgot password operation after prompting the user about the verification code and a new password.

This function receives a single argument as illustrated below

codestringsix digit long numeric code
passwordstringshould be minimum six character long

Upon execution, this method returns the following code in form of promise


password has been updated


verification code is invalid


failed to verify the verification code


data format is invalid


failed to update the profile

Use of forgotPassword method has been illustrated in the example below

// Variable to hold the confirmForgotPassword
// method so that it could be used afterwards
var confirm = null;
// Get user data from the inputs and
// Submit request to the server
auth.forgotPassword(email).then((res) => {
  // Got the response
  // So checkout the response code
  switch(res.code) {
    case "PHONE-CODE-SENT": 
      // Verification code has been sent
      confirm = res.confirm;
// After getting response from forgot password request
// Prompt the user about the verification code
// and submit it to server with the confirm method
confirm(code).then((res) => {
  // Got the response
  switch(res.code) {
        // Password has been updated