Consumer Authentication

/

Mobile SDKs

/

React Native SDK reference

/

Biometrics

/

Authenticate

Authenticate

If a valid biometric registration exists, this method confirms the current device owner via the device's built-in biometric reader and returns a session object by either starting a new session or adding a biometric factor to an existing session.


Method parameters


Options*object

Configuration options.

prompt*string
session_duration_minutes*int
cancelButtonTextstring
allowDeviceCredentialsstring
import React, { useCallback } from 'react';
import { Text, TouchableOpacity, View } from 'react-native';
import { useStytch } from '@stytch/react-native';

export const Authenticate = () => {
  const stytch = useStytch();

  const authenticateBiometrics = useCallback(() => {
    stytch.biometrics.authenticate({
      prompt: 'Login with Biometrics',
      sessionDurationMinutes: 60,
    });
  }, [stytch]);

  return (
    <View>
      <TouchableOpacity onPress={authenticateBiometrics}>
        <Text>Authenticate with Biometrics</Text>
      </TouchableOpacity>
    </View>
  );
};