Custom Error Conditions on Sign Up. I'm adding an additional username field on account creation and ...
k
Custom Error Conditions on Sign Up. I'm adding an additional username field on account creation and saving that along with the userid, and email to my app db (separate from supertoken db). What I'm trying to figure out is if there is a prescribed way of handling errors in this scenario, and rolling back the entire creation on failure. I override emailPasswordSignUpPOST, to get the fields and persist, but how do I rollback transaction in event there is some error thrown by my custom logic
r
Hey @kabal48 you could detect if there is an inconsistency during sign in, and do the same operation post sign in
If your logic during sign up fails, then the user won’t be logged in, and then they will have to sign in, during which you can do this custom logic
If you don’t have all the info available during sign in, you will have to ask them for it again post sign in.
So it might just be better to ask them the info post sign up / sign in anyway. And guard your frontend and backend to make sure that that info is submitted before allowing access to the app
k
What about the operation to duplicate the user to my own db. Since that can also fail is there no way to rollback original signup in super tokens?
r
Well, there is, you can call the delete user api, but again, that can fail too. Resulting in the same issue.
So therefore, whatever extra info you want to associate with the user, it’s best to ask post sign up / in.
But practically, this happens very rarely and most of the time doesn’t matter. Unless you have millions of users
5 Views