DITAuthenticator

@interface DITAuthenticator : NSObject

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.

    Declaration

    Objective-C

    - (void)loginWithToken:(nonnull NSString *)token
                  provider:(nullable NSString *)provider
                completion:(nonnull void (^)(NSError *_Nullable))completion;

    Parameters

    token

    the authentication token required to log in.

    provider

    the name of the authentication provider.

    completion

    a block that will get called when the login attempt has completed.

  • Log in to Ditto with a username and password.

    Declaration

    Objective-C

    - (void)loginWithUsername:(nonnull NSString *)username
                     password:(nonnull NSString *)password
                     provider:(nullable NSString *)provider
                   completion:(nonnull void (^)(NSError *_Nullable))completion;

    Parameters

    username

    the username component of the credentials used for log in.

    password

    the password component of the credentials used for log in.

    provider

    the name of the authentication provider.

    completion

    a block that will get called when the login attempt has completed.

  • Query whether Ditto has a valid authentication token.

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

    Declaration

    Objective-C

    - (BOOL)isAuthenticated;
  • Return the currently logged-in user ID.

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

    Declaration

    Objective-C

    - (NSString *_Nullable)userID;