I am currently Building a SAAS where other resources are mapped to a specific user which attribute should I use for that ? is user_id unique ?
As mentioned in (https://auth0.com/docs/users/identify-users) you can use the
user_id (surfaced in ID tokens as
sub) as a user identifier as the value should be unique within a tenant. Have in mind that account linking may lead to some sort of changes to user identifier, but only from the perspective that before linking you have two independent identities (user identifiers) and in order to link them you’ll have to choose the user identifier (identity) that wins (becomes main identity).
In addition, for additional flexibility and to possible be more future-proof you can still use your own identifiers across your system and then have a single mapping table that maps the user identifier from Auth0 into your own. However, this is not strictly necessary.