DITAuthenticator
@interface DITAuthenticator : NSObject
Log in to a remote authentication service, using 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 anOnline
identity, after a successful login. If the authentication token is allowed to expire then it will returnNO
instead.Declaration
Objective-C
- (BOOL)isAuthenticated;
-
Return the currently logged-in user ID.
This will return
nil
if there is no valid authentication orOnline
mode is not being used.Declaration
Objective-C
- (NSString *_Nullable)userID;