Identify Users
There are two recommended options to uniquely identify your users:
By the
user_idproperty. This is guaranteed to be unique (within a tenant) per user (such as{identity provider id}|{unique id in the provider}orfacebook|1234567890). A user may have the sameuser_idproperty across multiple Auth0 tenants, but consistency is not guaranteed.By a natural key, like the
emailproperty. In this case, it is recommended that you enable email verification and only use this option with providers that require that users verify their emails.
If you use custom databases, you must return a unique user_id property. If you have multiple custom databases and expect possible collisions between ids from different connections, you should use a prefix identifying the connection. For example:
function login (email, password, callback) {
var user = getUserFromDB(email);
var profile = {
user_id: 'MyConnection1|' + user.id,
email: user.email,
[...]
};
callback(null, profile);
}Was this helpful?