Password recovery for user with no email ??

Hi -

In our Android app, we have user ‘mobile number’ as the userid - as we dont expect all users to be active email users.

So, our case demands sending new temporary password over SMS only. However, I am not able to think of on how I can achieve the same in backendless.

I can use afterRestorePassword to send SMS - but we don’t get new password value in it.

Can you please suggest any workaround ??




Unfortunately, backendless expects BackendlessUser to have email in order to execute restore password feature properly.
For your case I can offer you to create your own “restorePassword” feature using hosted service. For example, method implementing it might look like the following:

public void restorePassword( String userPhone )
BackendlessDataQuery query = new BackendlessDataQuery( "userPhone=" + userPhone );
BackendlessCollection<BackendlessUser> response = Backendless.Data.of( BackendlessUser.class ).find( query );
if( response.getData().size() == 0 )
// user not found, throw exception
BackendlessUser targetUser = response.getData().get( 0 );
String newPassword = generateRandomPassword();
targetUser.setPassword( newPassword );
Backendless.UserService.update( targetUser );
// send sms with new password to the user

Best regards,

ahhh, you mean create a REST API for this. This will work just fine for us. Thanks.

Not just REST, you’ll be able to call the methods through any supported sdk, including android.