Realm Sync anonymous authentication for silent login

My app uses Realm Sync to synchronize data across a user’s devices. The authentication is done with Firebase. However, the users can use the app without signing in, in which case the data is stored locally and not synced.

The current documentation states (here):

Every installation of your app should be uniquely identified as an individual user even if your app does not explicitly require the user to log in. In the case where your app does not require the user to log in, perform a silent login in the app code, which effectively creates a unique identifier for that app installation.

But is also states (also here):

You should disable anonymous authentication after you complete your proof of concept.

I wonder how this “silent login” could be done without anonymous authentication, since the other authentication method is JWT, and this require email and password. How can I silently authenticate a user without any email or password?

Hi Jean-Baptiste_Beau,

We do not recommend keeping the anonymous auth but you can use it if you have to.

We also have a function based authentication which you can customize to perform a “silent” auth. Perhaps querying the cluster for the user existence :slight_smile:

https://docs.mongodb.com/realm/authentication/custom-function/

Best regards,
Pavel

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