Class

# UserAuthentication

<div class="rst-class">

forsearch

</div>

Authentication

<div class="rst-class">

forsearch

</div>

TouchID

<div class="rst-class">

forsearch

</div>

FaceID

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Allows the user to authenticate either with FaceID or TouchID.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                        | Type                                          | Read-Only | Shared |
|---------------------------------------------|-----------------------------------------------|-----------|--------|
| `Name<userauthentication.name>`             | `String</api/data_types/string>`              | ✓         |        |
| `SensorType<userauthentication.sensortype>` | `SensorTypes<userauthentication.sensortypes>` |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                  | Parameters                                                                                                                       | Returns                                     | Shared |
|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------|--------|
| `Handle<userauthentication.handle>`   |                                                                                                                                  | `Ptr</api/data_types/additional_types/ptr>` |        |
| `Request<userauthentication.request>` | reason As `String</api/data_types/string>`, includePasscode As `Boolean</api/data_types/boolean>` = `False</api/language/false>` |                                             |        |
| `Reset<userauthentication.reset>`     |                                                                                                                                  |                                             |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                                  | Parameters                                                    | Returns |
|-----------------------------------------------------------------------|---------------------------------------------------------------|---------|
| `AuthenticationSucceeded<userauthentication.authenticationsucceeded>` |                                                               |         |
| `Closing<userauthentication.closing>`                                 |                                                               |         |
| `Error<userauthentication.error>`                                     | error As `RuntimeException</api/exceptions/runtimeexception>` |         |
| `Opening<userauthentication.opening>`                                 |                                                               |         |

## Enumerations

<div id="userauthentication.sensortypes">

<div class="rst-class">

forsearch

</div>

</div>

UserAuthentication.SensorTypes

### SensorTypes

> Specifies the type of sensor the device has for authentication.
>
> | Enum        | Description                                       |
> |-------------|---------------------------------------------------|
> | None        | The device has no sensor for user authentication. |
> | Fingerprint | The device has a fingerprint sensor.              |
> | Face        | The device has a facial recognition sensor.       |

## Property descriptions

<div id="userauthentication.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

UserAuthentication.Name

**Name** As `String</api/data_types/string>`

> The name of the control.
>
> This property is read-only.

<div id="userauthentication.sensortype">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

UserAuthentication.SensorType

**SensorType** As `SensorTypes<userauthentication.sensortypes>`

> The type of sensor the device provides for authentication.

## Method descriptions

<div id="userauthentication.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

UserAuthentication.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

> The handle is used to get a reference to the object for interfacing directly with the Android or iOS API.

<div id="userauthentication.request">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

UserAuthentication.Request

**Request**(reason As `String</api/data_types/string>`, includePasscode As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Requests that the OS display its user interface that requires the user to authenticate as being the owner of the device.
>
> The *reason* parameter is text displayed to the user explaining why they are required to authenticate. The *includePasscode* parameter indicates whether or not the user should be allowed to enter the device passcode should the primary means of authentication (typically face or fingerprint) fail.

<div id="userauthentication.reset">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

UserAuthentication.Reset

**Reset**

> Cancels the request for user authentication.
>
> This will also allow you to request authentication a second time if necessary after the user successfully authenticates.

## Event descriptions

<div id="userauthentication.authenticationsucceeded">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

UserAuthentication.AuthenticationSucceeded

**AuthenticationSucceeded**

> The user successfully authenticated with the device.

<div id="userauthentication.closing">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

UserAuthentication.Closing

**Closing**

> Called when the control's layout is closing.

<div id="userauthentication.error">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

UserAuthentication.Error

**Error**(error As `RuntimeException</api/exceptions/runtimeexception>`)

> An *error* occurred during authentication. The most common error would be that the user failed to authenticate. The error number and message in the `RuntimeException</api/exceptions/runtimeexception>` are provided directly from the OS itself.

<div id="userauthentication.opening">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

UserAuthentication.Opening

**Opening**

> Called when the control's layout is opening.
>
> This is where you typically put initialization code.
>
> This example in the Opening event of a label sets its text to "Hello":
>
> ``` xojo
> Me.Text = "Hello"
> ```

## Notes

<div class="warning">

<div class="title">

Warning

</div>

To use this class on iOS you must turn on the User Authentication switch by selecting iOS in the Build Settings of the Navigator and then clicking the Advanced tab in the Inspector.

</div>

When an application or a particular function of an application should be used only by the authorized user of the device, the <span class="title-ref">UserAuthentication</span> class can be used to ensure this. By requiring the user to authenticate, the device's operating system takes responsibility for this. Calling the Request method will begin the process. If it's successful, the AuthenticationSucceeded event will fire. If it fails, the Error event will fire. Keep in mind that this is an asynchronous process.

## Compatibility

|                       |        |
|-----------------------|--------|
| **Project Types**     | Mobile |
| **Operating Systems** | All    |

<div class="seealso">

`MobileControl</api/user_interface/mobile/mobilecontrol>` parent class; `RuntimeException</api/exceptions/runtimeexception>` class.

</div>
