DittoAuthenticator

public class DittoAuthenticator

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

  • Log in to Ditto with a third-party token.

    @param token the authentication token required to log in. @param provider the name of the authentication provider. @param completion a closure that will get called when the login attempt has completed.

    Declaration

    Swift

    public func loginWithToken(
        _ token: String,
        provider: String,
        completion: @escaping (DittoSwiftError?) -> Void
    )
  • Log in to Ditto with a username and password.

    @param username the username component of the credentials used for log in. @param password the password component of the credentials used for log in. @param provider the name of the authentication provider. @param completion a closure that will get called when the login attempt has completed.

    Declaration

    Swift

    public func loginWithCredentials(
        username: String,
        password: String,
        provider: String,
        completion: @escaping (DittoSwiftError?) -> Void
    )
  • Query whether Ditto has a valid authentication token.

    This will only be true when using an Online identity, after a successful login. If the authentication token is allowed to expire then it will return false instead.

    Declaration

    Swift

    public func isAuthenticated() -> Bool
  • The currently logged-in user ID.

    This will return nil if there is no valid authentication or Online mode is not being used.

    Declaration

    Swift

    public var userID: String? { get }