diff --git a/examples/kotlin/shared/src/commonTest/kotlin/com/mongodb/realm/realmkmmapp/AppClientTest.kt b/examples/kotlin/shared/src/commonTest/kotlin/com/mongodb/realm/realmkmmapp/AppClientTest.kt index 05890fed01..afb178df95 100644 --- a/examples/kotlin/shared/src/commonTest/kotlin/com/mongodb/realm/realmkmmapp/AppClientTest.kt +++ b/examples/kotlin/shared/src/commonTest/kotlin/com/mongodb/realm/realmkmmapp/AppClientTest.kt @@ -79,7 +79,7 @@ class AppClientTest : RealmTest() { val customBaseUrl = "http://localhost:80" // :snippet-start: change-base-url // Specify a custom baseUrl to connect to. - // In this case, an Edge Server instance running on the device. + // In this case, an Edge Server instance running on the device: val config = AppConfiguration.Builder(EDGE_SERVER_APP_ID) .baseUrl("http://localhost:80") .build() @@ -92,7 +92,8 @@ class AppClientTest : RealmTest() { assertNotNull(app.currentUser) // :remove-end: - // Later, change the baseUrl to the default: + // Later, change the baseUrl. + // In this case, pass `null` to reset to default: // https://services.cloud.mongodb.com app.updateBaseUrl(null) // :snippet-end: diff --git a/examples/kotlin/shared/src/commonTest/kotlin/com/mongodb/realm/realmkmmapp/AuthenticationTest.kt b/examples/kotlin/shared/src/commonTest/kotlin/com/mongodb/realm/realmkmmapp/AuthenticationTest.kt index 844e9a0836..0a57a11b39 100644 --- a/examples/kotlin/shared/src/commonTest/kotlin/com/mongodb/realm/realmkmmapp/AuthenticationTest.kt +++ b/examples/kotlin/shared/src/commonTest/kotlin/com/mongodb/realm/realmkmmapp/AuthenticationTest.kt @@ -471,9 +471,9 @@ class AuthenticationTest: RealmTest() { app.close() } - /* - ** Tests for Multi-User Applications page ** - */ +/* +** Tests for Multi-User Applications page ** +*/ private val app = App.create(YOUR_APP_ID) val joeEmail = getRandomEmail() diff --git a/source/examples/generated/kotlin/AppClientTest.snippet.change-base-url.kt b/source/examples/generated/kotlin/AppClientTest.snippet.change-base-url.kt index ffc89acb05..59370233de 100644 --- a/source/examples/generated/kotlin/AppClientTest.snippet.change-base-url.kt +++ b/source/examples/generated/kotlin/AppClientTest.snippet.change-base-url.kt @@ -1,5 +1,5 @@ // Specify a custom baseUrl to connect to. -// In this case, an Edge Server instance running on the device. +// In this case, an Edge Server instance running on the device: val config = AppConfiguration.Builder(EDGE_SERVER_APP_ID) .baseUrl("http://localhost:80") .build() @@ -7,6 +7,7 @@ val app = App.create(config) // ... log in a user and use the app ... -// Later, change the baseUrl to the default: +// Later, change the baseUrl. +// In this case, pass `null` to reset to default: // https://services.cloud.mongodb.com app.updateBaseUrl(null) diff --git a/source/sdk/kotlin/app-services/connect-to-app-services-backend.txt b/source/sdk/kotlin/app-services/connect-to-app-services-backend.txt index 27dec9a81f..95dafa069d 100644 --- a/source/sdk/kotlin/app-services/connect-to-app-services-backend.txt +++ b/source/sdk/kotlin/app-services/connect-to-app-services-backend.txt @@ -300,16 +300,13 @@ annotation: .. literalinclude:: /examples/generated/kotlin/AppClientTest.snippet.experimental-opt-in.kt :language: kotlin -Change Server with Logged-In User -````````````````````````````````` - -If you want to change the ``baseUrl`` after you have logged in a user and +If you change the ``baseUrl`` *after* you have logged in a user and have opened a synced database, the app must perform a client reset. For more -information, refer to :ref:`flutter-client-reset`. +information, refer to :ref:`kotlin-client-reset`. Perform the following in your code: -1. :ref:`Pause the Sync session ` +1. :ref:`Pause the Sync session ` 2. Update the ``baseUrl`` using the ``app.updateBaseUrl`` method 3. Re-authenticate the user to log in using the new ``baseUrl`` 4. Open a synced database pulling data from the new server