Onymos Raises $12M Series A: Learn why

onymos-logo
biometic icon

Quickstart Guide: Biometrics Component

Biometrics Component

Select a framework to get started.

Get started

Using Ionic or Cordova? Get the Biometrics component working in your app in four easy steps.

  1. Download the component
  2. Add it to your environment
  3. Using Biometrics
  4. Troubleshoot

1. Download the Onymos Biometrics component

Sign up! We’ll send you a link to your component, set up your Onymos Cloud Account, and generate your Onymos license credentials. In the meantime, you can get familiar with our API Documentation and developer resources, or join a whole community of developers building apps with Onymos on Reddit!

2. Add it to your environment

Add your components to a folder in your app’s root (e.g., onymos_components).

Add the Onymos Initialize component to your environment.

$ ionic cordova plugin add onymos_components/onymos-component-initialize

Then we can add the Onymos Biometrics component.

$ ionic cordova plugin add onymos_components/onymos-component-bioauth

Then update the widget inside your config.xml with the Onymos Widget ID you receive after you create an Onymos Cloud Account.

3. Using Biometrics

Use the Onymos Biometrics component to level up your app’s security!

Before we use Biometrics, let’s make sure we have everything we need to configure your onymosConnectObject. The onymosConnectObject requires the appropriate Onymos license credentials: your Customer ID (also called an Onymos ID) and your Onymos Auth Token. You’ll need these credentials to use this (or any) component in your app. To generate your Onymos license credentials, create an Onymos Cloud Account.

NOTE: Your Onymos Auth Token will work with any number of apps and components. Onymos has a developer—and project—friendly pricing model. You can use any or all of our components in an app at no cost until it is installed on 100 or more devices. This is ideal for iterating your MVP (see detailed pricing here).

Next, let’s go inside your Ionic app’s app.component.ts file and initialize Biometrics.

import { Component } from '@angular/core';
import { Platform } from '@ionic/angular';
    
    declare var OnymosInitialize: any;
    declare var OnymosBiometrics: any;
    
    @Component({
      selector: 'app-root',
      templateUrl: 'app.component.html',
      styleUrls: ['app.component.scss'],
    })
    export class AppComponent {
      constructor(
        private platform: Platform
      ) {
            this.initializeApp();
        }
      
     initializeApp(){
        this.platform.ready().then(() => {
    
          const OnymosConnectObject={
            customerId : 'Your customerId goes here', 
            onymosAuthToken : 'Your onymosAuthToken goes here',  
            envType: 'PRD'
            }
    
          OnymosInitialize.initialize(
            OnymosConnectObject,
          
            function onymosInitializeSuccess(status){
              console.log("Onymos initialized Successfully.", status)
            },
    
            function onymosInitializeFailure(error){
              console.log("Onymos failed to initialize.", error)
            })
        })
      }
    }
    

Great! If we configured your onymosConnectObject correctly, onymosInitializeSuccess() should print its message to the console. Now we’re ready to use Biometrics.

Let’s create our own function called isAvailable() in the app.component.ts file. We’ll use it to invoke the isAvailable() method on Biometrics.

isAvailable(){
  OnymosBioauth.isAvailable(

    function isAvailableSuccess(bioauthAvailable, bioauthTypeObj) {
      console.log(bioauthAvailable, bioauthTypeObj)
      // bioauthTypeObj is only available on iOS devices.
    },

    function isAvailableFailure(error) {
      console.log(error)
    })
}

BioauthAvailable is a boolean that describes whether or not a device can use bio authentication. BioauthTypeObj is an object that describes what kind of bio authentication is available on a device. Let’s leverage bio authentication on devices that can use it!

Create another function in the app.component.ts file called authenticate() that will invoke the Biometrics method of the same name.

authenticate(){
  OnymosBioauth.authenticate(

    function authenticateSuccess(status) {
      console.log(status)
    },

    function authenticateFailure (error) {
      console.log(error)
    },

    options)
}

The authenticate() method includes several options for you to consider. Let’s incorporate a few—you can check out the Biometrics API documentation to learn more about all of them!

authenticate(){
  OnymosBioauth.authenticate(
  
    function authenticateSuccess(status) {
      console.log(status)
    },
  
    function authenticateFailure (error) {
      console.log(error)
    },
  
    {
      disableFallback: true,
      fallbackText: 'Enter Pin',
    })
}

With disableFallback set to false, a user can take advantage of their device’s system fallback when they can’t, or don’t want to, bio authenticate. The fallbackText string will appear on the fallback button.

With just these two functions your app is ready to deliver cutting-edge security to your users!

4. Troubleshooting

How do I squash this bug? Is Ionic supposed to do that? Why is this iOS build failing?

Let’s figure it out—join the Onymos community on Reddit! More of a loner? You can email us directly at customersuccess@onymos.com.

Dig into our API documentation

Developer support

Got questions? Our support team is here to help.

Think differently about app development

Download our free white paper today to learn how Onymos Features can maximize the value of your developer resources — and shave days or weeks off your development timeline.

Get your free white paper