Which ID for reference?

Hi guys,

which ID should I use for reference in internal dbo? Specially when user has linked identities. The user_id will always be prefixed with “auth0|” string? Even if user has single social identity (Facebook for example) ?

Thanks

{
    "created_at": "2020-03-29T10:19:58.774Z",
    "email": "john.doe@gmail.com",
    "email_verified": false,
    "identities": [
        {
            "connection": "Username-Password-Authentication",
            "user_id": "5e80764e87.............",
            "provider": "auth0",
            "isSocial": false
        }
    ],
    "name": "john.doe@gmail.com",
    "nickname": "john.doe"
    "updated_at": "2020-03-29T10:19:58.774Z",
    "user_id": "auth0|5e80764e87......",
    "blocked_for": [],
    "guardian_authenticators": []
}

You should always use the full user_id attribute.

The user_id is always prefixed with the primary identity’s connection strategy (not to be confused with the connection name). The auth0 prefix is only present if the primary identity of the user is an Auth0 database connection.

For enterprise connections the connection name will also be prefixed, so the user_id will be formatted as follows: connection strategy|connection name|user ID from identity provider.

Thanks for your reply. So, as far as I understand, the user_id from my sample, which should be used as reference in my local db should include ´auth0|5e80764e87…´, with the prefix. Yes?

And, if user merge/link another account, this primary identity does change?

Thanks