Problem in sign up flow using lazy migration (custom database) and new universal login

Hi guys, I’m having a problem with lazy migration (custom database?) and new universal login (I managed to make it work in classic universal login but it seems that in new universal login the underlying logic is a little bit different).

The problem is in the sign up flow with new users (users that doesn’t exists in the legacy system).

If the Get User (loginByEmail) script return an error when the user doesn’t exists the signup fails.

If the Get User (loginByEmail) script return a null or empty user the Login (login) script is executed (and it fails since the user doesn’t exists in the legacy system).

I think I should return a different response in the loginByEmail script (to avoid the execution of the Login (login) script) but I can’t figure out how the correct response is.

The response I’m actually returning is

function loginByEmail(email, callback) {
  
    ...
        
    var user = {} ;
    if (paseRespuesta.usuario) { // <<< User exists in legacy system
    	user.user_id = paseRespuesta.usuario.uid ;
    	user.email = paseRespuesta.usuario.email ;
    } else { // <<< User does not exists in legacy system
//      user = null ; // <<< I also tried this
    }

    callback(null, user);

  });

}

Any help will be greatly appreciated.

Regards

Sorry guys, it seems I forgot to check ‘Import Users to Auth0’ in the settings tab … please ignore this post.

1 Like

No worries! We’ve all been there! Glad you have figured it out!