An LAContext object represents an authentication context. The LAContext class provides a programmatic interface for evaluating authentication policies and access controls, managing credentials, and invalidating authentication contexts.


Authentication contexts are used to evaluate authentication policies, allowing apps to request the user to authenticate themselves using biometric methods.


Evaluating Authentication Policies

func canEvaluatePolicy(LAPolicy, error: NSErrorPointer)

Preflights an authentication policy to see if it is possible for authentication to succeed.

var evaluatedPolicyDomainState: Data?

The current state of the evaluated policy domain.

var biometryType: LABiometryType

The type of biometric authentication supported by the device.

var maxBiometryFailures: NSNumber?

Allows setting the limit for the number of failures during biometric authentication.


Evaluating Access Controls

var interactionNotAllowed: Bool

A Boolean value indicating whether authentication can be interactive.

Customizing Authentication Prompts

var localizedReason: String

The localized explanation for authentication shown in the dialog presented to the user.

var localizedFallbackTitle: String?

The localized title for the fallback button in the dialog presented to the user during authentication.

var localizedCancelTitle: String?

The localized title for the fallback button in the dialog presented to the user during authentication.

Managing Credentials

func setCredential(Data?, type: LACredentialType)

Sets an application-provided credential to be used when evaluating authentication.

func isCredentialSet(LACredentialType)

Returns whether the specified credential type is set.

var touchIDAuthenticationAllowableReuseDuration: TimeInterval

The duration for which Touch ID authentication reuse is allowable.

Invalidating the Authentication Context

func invalidate()

Invalidates the authentication context.


Local Authentication Error Domain

The error domain for the Local Authentication framework.

enum LAError.Code

Error codes that can be returned when evaluating a policy.

enum LAPolicy

Policies specifying which forms of authentication are acceptable.

enum LACredentialType

The types of credentials to be used for authentication.

enum LAAccessControlOperation

Operations to be evaluated for access control by the evaluateAccessControl(_:operation:localizedReason:reply:) method.

Touch ID Authentication Reuse

Durations for Touch ID authentication reuse, used by the touchIDAuthenticationAllowableReuseDuration property.


Inherits From

Conforms To