DittoAuthenticator

class DittoAuthenticator

Log in to a remote authentication service, using an OnlineWithAuthentication or an Online identity.

Types

Companion
Link copied to clipboard
object Companion

Functions

isAuthenticated
Link copied to clipboard
fun isAuthenticated(): Boolean

Query whether Ditto has a valid authentication token.

loginWithCredentials
Link copied to clipboard
fun loginWithCredentials(username: String, password: String, provider: String, completion: (DittoError?) -> Unit)
fun loginWithCredentials(username: String, password: String, provider: String, completionCallback: DittoLoginCompletionCallback)

Log in to Ditto with a username and password.

loginWithToken
Link copied to clipboard
fun loginWithToken(token: String, provider: String, completion: (DittoError?) -> Unit)
fun loginWithToken(token: String, provider: String, completionCallback: DittoLoginCompletionCallback)

Log in to Ditto with a third-party token.

logout
Link copied to clipboard
fun logout(cleanupFn: (Ditto) -> Unit? = null)
fun logout(cleanupFn: DittoLogoutCleanupFn)

Log out of Ditto.

observeStatus
Link copied to clipboard
fun observeStatus(callback: (DittoAuthenticationStatus) -> Unit): Closeable

Registers a callback that is called whenever the authentication status changes.

fun observeStatus(callback: DittoAuthenticationStatusDidChangeCallback): Closeable

Registers an observer object that is called whenever the authentication status changes.

Properties

status
Link copied to clipboard
var status: DittoAuthenticationStatus

Returns the current authentication status.

userId
Link copied to clipboard
val userId: String?

Return the currently logged-in user ID.