Our team has found it to be incredibly frustrating that Auth0 automatically prefixes the sub value with auth0|, even when using a custom database. Our users are not stored in the database as auth0|12345– they are stored as simply 12345. So now the token is useless for referencing a user in our database. We have to (1) check the sub every time and strip the provider prefix if (and only if) it’s auth0, or (2) include a custom claim and only use that… Which in my opinion defeats the purpose of even having a sub claim (and makes social logins harder to implement). Both options are ugly.
Is there no way around this? I’ve tried inserting users into our custom database with the prefix already added, but that results in something like auth0|auth0|12345.
What is the convention for dealing with actual user IDs? Surely I’m missing something.