OnlineWithAuthentication

class OnlineWithAuthentication @JvmOverloads constructor(dependencies: DittoDependencies, appID: String, callback: DittoAuthenticationCallback, enableDittoCloudSync: Boolean, customAuthUrl: String?) : DittoIdentity

Run Ditto in secure production mode, logging on to Ditto Cloud or on on-premises authentication server. User permissions are centrally managed. Sync will not work until a successful login has occurred.

The only required configuration is the application's UUID, which can be found on the Ditto portal where the app is registered.

By default cloud sync is enabled. This means the SDK will sync to a Big Peer in Ditto's cloud when an internet connection is available. This is controlled by the enableDittoCloudSync parameter. If true (default), a suitable wss:// URL will be added to the TransportConfig. To prevent cloud sync, or to specify your own URL later, pass false.

Authentication requests are handled by Ditto's cloud by default, configured in the portal at https://portal.ditto.live.

To use a different or on-premises authentication service, pass a custom HTTPS base URL as the customAuthUrl parameter.

Parameters

dependencies

the dependencies required by the SDK to be initialised.

appID

a UUID identifying this app registration on the Ditto portal, which can be found at https://portal.ditto.live.

callback

a handler for when Ditto requires (re)authentication.

enableDittoCloudSync

if true, auto-configure sync with Ditto Cloud.

customAuthUrl

if specified, use a custom authentication service instead of Ditto Cloud.

Constructors

OnlineWithAuthentication
Link copied to clipboard
fun OnlineWithAuthentication(dependencies: DittoDependencies, appID: String, callback: DittoAuthenticationCallback, enableDittoCloudSync: Boolean = true, customAuthUrl: String? = null)

Functions

close
Link copied to clipboard
fun close()
requiresOfflineLicenseToken
Link copied to clipboard
fun requiresOfflineLicenseToken(): Boolean

Properties

appID
Link copied to clipboard
val appID: String
callback
Link copied to clipboard
val callback: DittoAuthenticationCallback
customAuthUrl
Link copied to clipboard
val customAuthUrl: String? = null
dependencies
Link copied to clipboard
val dependencies: DittoDependencies
enableDittoCloudSync
Link copied to clipboard
val enableDittoCloudSync: Boolean = true