Realm Sync - Switch anonymous user to authenticated user after 90 days

I am building a utility app for iOS. I really want to avoid to push my users to sign-up at the first launch of my app. When my users are satisfied with my app and finally decide to sync their data across multiple devices, then they will pay for the feature and sign-up.

In this scenario, I must serve basic features with anonymous authentication for a while(might be forever), and then, when my user activates a paid feature, sync in this case, the user would sign-up and I will have to link user identities to the existing anonymously authenticated account.

But I see the document says “Realm may delete an Anonymous user object that is 90 days old (or older). When an account is deleted, it is not recoverable and any associated user data is lost. Documents created or modified by the user remain unaffected.” in this link

That means I have to tell my user “You have approx 90 days for free use. You must pay for the advanced features and sign up within 90 days, otherwise your data will be lost forever.”

As you guys know, many apps out there have a multi-devices sync feature as a paid plan. But it seems that this is not possible with MongoDB Realm Sync unless I push my users to sign-up at the first launch of my app.
I really do not want to do that because in that way I will obviously lose many potential users.

Any solution or best practices for this scenario?


1 Like


I didn’t know about this. But I’m pretty sure they’re talking about inactive anonymous users. Someone from Mongo should give you the answer. Maybe open a support ticket

However if you’re on iOS maybe consider offering Sign in with apple as mandatory as it’s very convenient, anonymous and people are used to it, then make the sync feature as part of a in-app subscription/purchase

Hey, Vincent.

Did you ever figure this out?


Just following up here that I was able to figure this out in case anyone else is trying to do the same.

Anonymous auth really is just temporary.

But I wanted to let users use my app indefinitely with the backend in place and then just create a real JWT token backed user and link the users if/when they want to upgrade to sync to multiple devices.

I utilized Cosync which is built to provide JWT auth for MongoDB Realm.

I sign up real subscribed users with email/password so that I can facilitate password resets and all the normal real user auth stuff.

But I just pass in two UUIDs for email/password to create a one time JWT token so that the user can use the app, get a Realm User ID that I use in my partition, and as long as they never lose/wipe their device, they can keep using it no matter how long they are offline and their user will never expire.

In my case, this is beneficial because if something happens to that user’s device and I decide to help them rescue their data, if everything was in a local realm, that would be gone. But since there is a version that is backed up to the server, I could help them rescue it by find/replace UUID in a server function.

Hope that helps and makes sense for anyone else trying to figure this out.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.