Changing authentication server with logged in SyncUsers



We are currently preparing to migrate our server from ROS 1.x to ROS 2.x, and will also be migrating the server (incl. auth server) to a new address.

We would like to do this simultaneously, and do not want to force our users to log out before the transition. However, already logged in users have an active SyncUser, whose authentication server is still saved from their previous login. Therefore, when we try to open their synced realms the process fails as the old server address is preserved.

We can work around this by logging them out and then back in again, however this leads to the deletion of their local Realms before the backup configuration is saved, thereby discarding any unsynced changes.

In terms of code (the example in the docs), if we logout and then re-login SyncUser.current in order to change the authentication server:

do {
    let mySyncedRealm = try Realm(configuration: config)
} catch let e as Realm.Error where e.code == .incompatibleSyncedFile {
} catch {}

Is there a way to change the address of the authentication server without losing any unsynced changes in the local Realm?