We were wondering what the best practice is for migrating user ids. Currently, we are using a system of randomly generated user ids (~20 characters). I know that auth0 generates an identifier that looks like this 102437854499766869014 (21 characters).
In terms of security, we looked into uuidv4 which looks like ad076419-fde7-4940-b18c-1d86607491f0 and we weren’t sure what the best practices are for migrating these ids.
Should we migrate the current ids (~20 characters) into auth0 and use auth0’s generated ids in the future or keep our own set of ids?
Auth0 stores user IDs as {identity provider id}|{unique id in the provider} or facebook|1234567890. This way within a tenant, a user’s ID will be unique.
If you plan to use a Custom Database , then the most important thing would be to structure the ID in a way that the IDs will not collide, for example:
function login (email, password, callback) {
var user = getUserFromDB(email);
var profile = {
user_id: 'MyConnection|' + user.id,
email: user.email,
[...]
};
callback(null, profile);
}