Overview
This article explains why a custom database user profile may not update upon login for some users when using a login script designed to set user_metadata
values. Other symptoms include the last_login
and login_count
properties not updating, even after a successful login session.
Applies To
- Connections
- Custom Database
- Login
Cause
This issue occurs when multiple users share the same user_id
. Although user IDs must be unique, with custom databases, it is possible to create multiple users with the same ID, as described in the Auth0 Community article Updating Users with Duplicate User IDs. The system is unable to determine which user profile to update, causing the login script changes to fail.
Solution
If multiple users share the same user_id
, one of two actions can be taken.
- To maintain both user profiles, follow the process outlined in the article Updating Users with Duplicate User IDs to assign a new, unique
user_id
to one of the profiles. - If one of the profiles was created accidentally or is no longer needed, delete the extraneous user.
-
- Ensure the email addresses for the duplicate profiles are unique.
- Use the Delete a connection user endpoint to delete the specified user from the connection.