Create unique Company ID

Is it possible to create a unique company ID when creating a new user based on their corporate email? Once this UniqueID is created, we want to look up each new user to check if the company already has an account or not.

Many Thanks,


There’s no built in way to do this, but you could perfectly use app_metadata for this. Just create an object like this:

    "company": "<ID>"

You can then use the Search API to search for users with that company ID (note that the search API is really specific with app metadata: it needs to be an exact match, capitals and all).

However. You could also consider keeping this logic out of Auth0 entirely and store user ID and company ID in a separate database. But that entirely depends on your use case, wants and needs.

Thanks a lot @thijmen96 for sharing your knowledge here!

Are there future plans to support unique values / validation though the management API for app metadata / user metadata? The search endpoints are described as “eventually consistent” and I’ve personally seen two occurrences in the last month or so where the search indexes were stale due to an auth0 issue ( /

Hey there @Chris.Ward!

That’s a good question however I guess it would be best if our product managers address that. Can you submit it as feedback via our feedback site? This way one of our product managers will contact you back within 10 days and inform about potential future plans. Thank you!