Authentication
IMIconnect Two Factor Authentication (2FA) is an authentication process in which the user provides two means of identification from separate categories of credentials. It provides additional security. For example, a banking transaction a user may be asked to provide one time password (OTP) after they login with their username and password.
IMIconnect SDK provides Two Factor Authentication (2FA) service for mobile applications to validate their customer id (CRN and MSISDN) that are registered with IMIconnect profile manager. The OTP is valid for 30 minutes.
This interface has the following class:
ICUserAuthentication
This class exposes functionality which enables user authentication through a One Time Password sent over SMS. Two Factor Authentication (2FA) can also be implemented using this class.
generatePinForUserId
This method is used to generate a pin and sent to the user through SMS allowing him to authenticate with pin than the traditional login/password. The phone number must be provided when creating the user profile. If generation succeeds, error in completionHandler
will be nil.
Syntax: + (void)generatePinForUserId:(NSString *)userId completionHandler:(void (^)(NSError *error)) completionHandler;
Parameters:
Parameter | Type | Description |
---|---|---|
userId | NSString | Specifies a user id or customer id (CRN and MSISDN) that are registered with IMIconnect profile manager. |
Example:
[ICUserAuthentication generatePinForUserId: userId
completionHandler: ^ (NSError * error) {
if (error) {
NSLog(@ "Failed to generate PIN. Reason: %@", error.localizedDescription);
} else {
NSLog(@ "Generation succeeded.");
}
}
];
validatePin
This method is used to validate the pin with the IMIconnect platform. The result is reported through the callback specified when constructing the ICUserAuthentication
instance. If validation succeeds, error in completionHandler
will be nil.
Syntax: + (void)validatePin:(NSString *)pin forUserId:(NSString *)userId completionHandler:(void (^)(NSError *error))completionHandler;
Parameters:
Parameter | Type | Description |
---|---|---|
pin | NSString | Specifies the pin number to be validated that is received as SMS. |
userId | NSString | Specifies a user id or customer id (CRN and MSISDN) that are registered with IMIconnect profile manager. |
Example:
[ICUserAuthentication validatePin: pin
forUserId: userId
completionHandler: ^ (NSError * error) {
if (error) {
NSLog(@ "Failed to authenticate the user. Reason: %@", error.localizedDescription);
} else {
NSLog(@ "Authentication succeeded.");
}
}
];
Updated almost 2 years ago