Enabling or Disabling Authentication Types for iOS
casan221saas
A user can enable or disable specific authentication types from the list of authentication types that are supported by the SDK.
The PIN authentication type is always enabled. A user cannot disable it.
This section covers the following topics:
For information about the APIs mentioned in these topics, see API Reference for iOS.
Steps in the Enabling or Disabling Authentication Types Flow
The following steps take place when a user enables or disables authentication types:
- The user opens the app.
- The user taps the menu in the upper-left corner of the page.

- From the menu, the user taps the Manage Authentication Types option.
- The app displays the authentication types that are currently supported by the SDK.As shown in this screenshot, the PIN authentication type cannot be disabled.

- The user enables or disables authentication types according to her requirements. In the example shown in the previous screenshot, the user can disable biometric authentication (that is, fingerprint authentication).If the user enables biometric authentication, then the user is prompted to submit her PIN for authentication. After the PIN is verified, the SDK enables biometric authentication.
Enabling or Disabling Authentication Types Flow Diagram
The following flow diagram shows the sequence of API calls that take place when the user uses the Enabling or Disabling Authentication Types flow.
iOS - Enabling or Disabling Authentication Types

Sample Code for the Enabling or Disabling Authentication Types Flow
The following is sample code for the Enabling or Disabling Authentication Types flow:
## Sample code that is invoked when the Enable/Disable Authentication Type page is loadedAuthenticationHandler * authHandler = [[AuthenticationHandler alloc] init];NSMutableArray * authTypes = [authHandler getAllAuthenticationTypes];//Check if no authTypes available then prompt user to activate an account firestif([authTypes count] == 0) {// Take the User back to the Activation Screen because the User// has not configured any accounts so far.....} else if([authTypes count] == 2) {// Show the Configured Authentication Types to the User// The Option to disable/enable Default Authentication Type - User PIN// will be restricted by default.....for(Authentication * authType in authTypes) {if([authType authenticationType] == BIOMETRIC_AUTH) {if([authType authenticationTypeStatus] == DISABLED) {biometricSwitch.on = false;}}}} ## Sample code that is invoked when the Enable/Disable Authentication Type button is toggled for the biometric authentication typeAuthenticationTypeStatus authStatus = ENABLED;if(!biometricSwitch.isOn)authStatus = DISABLED;authentication = [[Authentication alloc] initWithData:BIOMETRIC_AUTH :authStatus];//Collect PIN from userif(authStatus == ENABLED) {//Show UI prompt to collect user PIN} else {[self updateAuthentication:authentication :nil];} ## Sample code that is invoked to verify user pin before update authentication is triggeredAuthenticationHandler * authHandler = [[AuthenticationHandler alloc] init];VerifyPINResponse * verifyPinResponse = [m3dsobject verifyPIN:pin];if([[verifyPinResponse status] isEqualToString:SUCCESS]) {[self updateAuthentication:authentication :pin];}else{// Show error message to user after reverting the biometric switch to ‘OFF’ in the UIbiometricSwitch.on = ([authentication authenticationTypeStatus] == ENABLED)?false:true;....}## Sample code that is invoked to update authentication type in the SDKAuthenticationHandler * authHandler = [[AuthenticationHandler alloc] init];UpdateAuthenticationResponse * updateAuthStatus = [authHandler updateAuthenticationType:authentication PIN:pin];if(![[updateAuthStatus status] isEqualToString:SUCCESS]) {// Show error message to user after reverting the biometric switch to ‘OFF’ in the UIbiometricSwitch.on = ([authentication authenticationTypeStatus] == ENABLED)?false:true;....}