iOS User Authentication with Realm via Backend Service

I had question regarding user authentication for iOS with MongoDB Realm for syncing the data between the mobile DB (i.e. Realm DB) on our phone and the backend DB (i.e. MongoDB Atlas cluster) in the cloud. I noticed that we have several ways to authenticate a user in our iOS app client including Google/Apple/Email etc using the App.login() method in RealmSwift API which creates a User object. This User object is required to instantiate a “Synced” Realm object. This Realm object will allow the MongoDB Realm Sync service to sync the data between local and cloud DBs. However, this may not be exactly how we want to achieve this. Ideally, we want our iOS app to be independent of the authentication mechanism to the backend database and just talk to our backend microservice which, in turn, will talk to the backend DB. How do we achieve this?

More concretely, we would like to have our iOS app client issue a login request to our backend microservice (written in NodeJS) which in turn uses the App.login() method to authenticate the user using Realm’s JavaScript API. If we did it this way, how do we open a Synced Realm in our iOS app? In other words, how do we pass the User object back to the iOS client to indicate that the user has been authenticated and open a Synced Realm. Can we do this by passing some sort of token back to the iOS app client denoting that the user has been authenticated and if so, how can we use this token to open a Synced Realm to start the syncing service.