Toggling Custom Database Import Mode Causes Login Failures

Overview

This article covers the scenario where moving from, for example, a Legacy Authentication configured Custom Database to an Automatic migration (for example, turning on "Import users to Auth0" for an existing custom database with users), after toggling import mode (Import users to Auth0) on and off and on again, users may fail to log in.

Applies To

  • Custom Database
  • Automatic migration
  • Import Mode

Cause

When a user logs in with import mode enabled, Auth0 will either:

  • Find the full user profile locally, skip calling the Custom Database action scripts, and compare the password against the hash stored in Auth0.
  • Not finding the full user profile locally, call the login script on the Custom Database to begin the migration process to complete the profile and verify the password against the legacy database.

 

Issues can occur if the following sequence occurs (typically during testing when import mode is being changed several times):

  1. Import mode is enabled.
  2. User logs in, completing migration, and the password hash is stored in Auth0.
  3. Import mode is disabled.
  4. The migrated user is now authenticating against legacy database credentials again.
  5. The password is changed in the legacy database, and the user is used to using these new credentials.
  6. Import mode is re-enabled.
  7. User attempts to use new credentials, but as the user has been previously migrated, the password is compared to the hash from the initial migration (step 2) and fails authentication.

 

Solution

This can be resolved with one of the following: 

  • Resetting the user password in Auth0.
  • Deleting the user in Auth0 to allow the profile to be freshly migrated from the legacy database on the next login.

 

Related References

Recommended content

No recommended content found...