Setting custom user data right after register

Im working on an app where a user can signup and add personal information (such as address, date of birth, etc.). I then register them via the email/password auth. Since the app is targeted for the german market I then use custom functions to send confirmation emails. So far so good. I now need to safe the custom date somehow when the user registers. Is there a way to save the custom user data as soon as I register the user and they are not yet confirmed, aka. pending? What is the best practice in this case?

3 Likes

Hi @Benedikt_Bergenthal,

Did you find a solution to the problem? we are also having a similar requirement where we ask for 3 information while registering.

  1. Name
  2. email
  3. password

the realm “register” function takes only “email” and “password”. We need to store the name in custom data object, untill the user confirm confirm the email and status changes from “pending” to “authenticated”.

1 Like

How I’d handle this would be to login with anonymous login after registration. You can then call a Realm function (that you write) to store the name ane email address in Atlas. You can then add an authentication trigger to run when the user is confirmed (the trigger should be registered against “CREATE” authentication events). The function associated with that trigger can then link the new user to the data that was anonymously added via the Realm function.

You can also link the anonymous user with the user that you’re registering – this is how it’s done on iOS: https://docs.mongodb.com/realm/sdk/ios/advanced-guides/link-user-identities/

2 Likes

I’m currently storing the additional infos in a cache DB using a custom API. When the user logs in for the first time using their account I use a trigger to transfer the data to the user and delete it from the cache.
Not very elegant, but it works. :wink:

1 Like