DeviceAuthentication external object

Official Content
This documentation is valid for:

Nowadays most of the mobile devices provide biometric sensors that allow the end user to authenticate locally. This type of authentication can be done through fingerprint recognition, facial recognition, retinal scanning, etc. and its objective is to make sure that the end user is the owner of the device.

The DeviceAuthentication external object allows you to interact with these different types of authentication where available, without worrying about device-specific considerations.

DeviceAuthentication_png EXODefinition_png

Properties

BiometricDescription property

Returns the name of the biometric authentication method available on the current device. For iOS, the possible values are "Touch ID", "Face ID", for Android are "Finger Print" or the empty value if the property IsAvailable returns False.

AllowableReuseDuration property

Indicates the minimum time (in seconds) before asking the user to locally authenticate again after one successful authentication.

Methods

IsAvailable method

Returns True if the API can be used in the current device, False otherwise.

Return value Boolean
Parameter method: DeviceAuthenticationPolicy
   

Authenticate method

Return value Boolean
Parameters method: DeviceAuthenticationPolicy, title:VarChar(40), usageDescription:VarChar(40)
   

This method performs the authentication step, using the method that corresponds to the current device.

If the method parameter is set to Biometrics, then only biometrics sensors will be used. If set to Any and biometrics is not available or is disabled, then the password will be used.

It returns True if the user could be authenticated, otherwise, it returns False. In particular, if the property IsAvailable has value False, the return value of this method is also False.

Calling the method without using the return value (assigning it to a variable, checking it in an if command, etc.) will make the Composite block containing the call to fail.

The title parameter is used to present the end user a title when they are prompted for the local authentication. It is used only in Android.

The UsageDescription parameter is used to present the end user with a message when they are prompted for the local authentication. It cannot be empty in iOS.

Domains

DeviceAuthenticationPolicy domain

Specifies the policy the developer wants to use.

Any Biometrics or Password.
Biometrics Only Biometrics. 
   

Examples

The code shown below is a very simple example created for this document.

Composite
    &BioComfirmed = DeviceAuthentication.Authenticate(DeviceAuthenticationPolicy.Any, 'Authenticate', 'Please authenticate')
    If &BioComfirmed
        //Access granted
        return
    Else 
        Actions.Cancel()
    EndIf
EndComposite

Executing this code will display the following screens, depending on whether the device allows biometric authentication. 

Authenticathion with Biometrics  Authentication when Biometrics is not accepted
image_2018614135951_1_png image_2018614135958_1_png

Availability

Available from GeneXus 15 Upgrade 11.

Scope

Platforms  Smart Devices(iOS, Android)

 

See Also:

DeviceAuthentication external object usage examples


Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.