I’m using the
realm-web SDK and
emailPasswordAuth. When I try to programmtically create new users with the
realm-web SDK it doesn’t confirm the new users or create the new user’s custom data record. In the Realm UI, I have the
Email/Password authentication provider enabled and configured with
User Confirmation Method set to
Automatically confirm users. All changes are published.
When I create a new user on the Realm UI, the new user is created and confirmed, causing the function that generates custom data to fire and the custom data to be created. This works without any trouble.
The same is not true for my application. I’m using NextJS and I have
app. When I call
app.emailPasswordAuth.registerUser, it registers the user but doesn’t automatically confirm the user, putting the user in the list of pending users and not creating the user’s custom data object.
Unlike the Realm UI, new users created with
emailPasswordAuth.registerUser are created in a pending status.
The user’s custom data isn’t being created until after the user logs in, which is problematic as the user’s custom data is what I can query and display on my web app. My current workaround is creating an API route that spins up an edge function which loads an instance of headless Chrome, logging the user in and out, then returning an HTTP status. It’s really not great for a ton of reasons.
The logs only indicate that an authentication action took place. There’s no indication of any issues.
Authentication on the Realm function that is creating the new user documents has no effect on the outcome of calling
I’m at a loss. How do I confirm new users and create custom user data using