Auth0: Create user in local database after Auth0 sign up : <p>I am using Auth0 to host all my user data. I also have my own backend, and I wish to have a <code>Users</code> table in it, which will map my db's generated <code>userId</code> to Auth0's <code>user_id</code>. I am hesitating between two flows on sign-up:</p>

<h1>Sign-up flow 1:</h1>

<ol>
<li>Frontend shows the Lock, user signs up.</li>
<li>After Auth0 redirects back to the frontend, frontend has the Auth0 <code>user_id</code>.</li>
<li>Frontend makes a call to backend on <code>POST /users</code> (public endpoint) to create a new user with <code>user_id</code>.</li>
<li>On each authenticated request to my backend resources server, the JWT contains the auth0 <code>user_id</code>, so the db makes a lookup between the <code>user_id</code> and my <code>userId</code>.</li>
</ol>

<h1>Sign-up flow 2:</h1>

<ol>
<li>Frontend shows the Lock, user signs up.</li>
<li>Configure a post-registration hook on Auth0 which calls <code>POST /users</code> on my backend. This call will generate my db's <code>userId</code> and send it back to Auth0.</li>
<li>Put this <code>userId</code> into Auth0's <code>user_metadata</code>.</li>
<li>This <code>user_metadata</code> will be included in the JWT, so that all calls to my backend to fetch resources will include the db's <code>userId</code> (no need for additional lookup).</li>
</ol>

<p>I feel 2 is more solid. Are there other sign-up flows? Do some auth0 customers use a similar flow to my #2? I didn't find much in their documentation.</p>
