DittoAuthenticator
public class DittoAuthenticator
Provides access to authentication information and methods for logging on to
Ditto Cloud. Relevant when using an onlineWithAuthentication or 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
truewhen using anonlineWithAuthenticationor anonlineidentity, after a successful login. If the authentication token is allowed to expire then it will returnfalseinstead.Declaration
Swift
public func isAuthenticated() -> Bool -
The currently logged-in user ID.
This will return
nilif there is no valid authentication oronlineWithAuthentication/onlinemode is not being used.Declaration
Swift
public var userID: String? { get }
DittoAuthenticator Class Reference