Object “authentication”

Object > NativeObject > Authentication

Allows to request authentication from the user. The means of authentication depends on the device configuration. For example, the authentication could be performed via credentials like pin or password or via a biometric authentication like fingerprint or face.

Type: Authentication extends NativeObject
Constructor: private
Singleton: authentication
Namespace: tabris
Direct subclasses: None
JSX Support: No

In order to enable face authentication on iOS an instructive message has to be added to the Info.plist file via the config.xml file.

<edit-config file="*-Info.plist" target="NSFaceIDUsageDescription" mode="overwrite">
  <string>Use FaceID to login to your account.</string>
</edit-config>

Examples

JSX

import {authentication} from 'tabris';

authentication.authenticate()
  .then((result) => console.log(result));

See also:

JSX Require user to authenticate

Methods

authenticate(options?)

Request the user to authenticate using the device default mechanism. The resolved promise returns a result object with 'status' and optionally 'message'. The 'status' Informs about the result of the authentication operation. In case of non-authentication flow errors like a incorrectly configured client, the promise is rejected.

Parameter Type Description
options {
  title: string, // The title shown in the authentication ui. optional
  subtitle: string, // The subtitle shown in the authentication ui. optional
  message: string, // The message shown in the authentication ui. optional
  allowCredentials: boolean, // Configure whether to allow another authentication mechanism other than biometric authentication. For example, when a fingerprint would be the device default, the user could choose to fallback to use a pin instead. When non-biometric credentials are used, no fallback is available. . defaults to true
  confirmationRequired: boolean // When a fast authentication mechanism like face unlock is used, this option allows to configure whether a successful authorization has to be confirmed by the user via a button press. defaults to true
}
A set of options to apply when authenticating. Optional.

Returns: Promise<{status: 'success'
| 'canceled'
| 'userCanceled'
| 'limitExceeded'
| 'lockout'
| 'biometricsNotEnrolled'
| 'credentialsNotEnrolled'
| 'error', message: string}>

canAuthenticate(options?)

Checks whether the device has any authentication mechanism configured. If the device does not require any authentication false is returned.

Parameter Type Description
options {
  allowCredentials: boolean // Configure whether to check another authentication mechanism other than biometric authentication. For example, when a fingerprint would be the device default, the user could choose to fallback to use a pin instead. When non-biometric credentials are used, no fallback is available. . defaults to true
}
A set of options to apply when authenticating. Optional.

Returns: boolean

cancel()

Closes a potentially open authentication ui.

Returns: undefined

Properties

availableBiometrics

iOS

The biometric authentication mechanisms available on the device. Currently supported values are 'fingerprint' and 'face'.

Type: string[]
Settable: No
Change Event: availableBiometricsChanged

Change Events

availableBiometricsChanged

Fired when the availableBiometrics property has changed.

EventObject Type: PropertyChangedEvent<Authentication, Array>

Property Type Description
value string[] The new value of availableBiometrics.