I want to 1: require users to provide username, em...
# support-questions-legacy
r
I want to 1: require users to provide username, email, and password; and 2: give users a userID of my own, and map it to the SuperTokens generated one with
createUserIdMapping()
. For (1) I'm following the "Changes to the emailpassword flow" guide. I understand doing custom form fields requires overriding the
apis:
section. And I understand for most overrides it's preferred to do it in the
functions:
section, and that's required for calling
createUserIdMapping()
. The problem is in the order of operations:
createUserIdMapping()
of course requires the userID generated by my database, so I must have already created the user. But to create the user I "need" access to username and email (actualEmail). But I seem to be unable to access actualEmail in the
functions:
section. That's fine, I'll make the call to create the user inside the
apis:
section, where actualEmail is accessible. But when I do that, the user hasn't been created in my database by the time I make the call to get the userID associated with the username. That is:
apis:
code seems to be called after
functions:
code. The workaround I could implement would be to make the email column in my users table nullable. Then with a call from the
functions:
section, create the user with only the username. Then in
apis:
, update the user record to have that email. That seems messy and more prone to error. Is there a simpler way?