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 [► Run in Playground]
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 | { |
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 | { |
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. |