react-native-sensitive-info: Android: Error: Fingerprint operation canceled, iOS no response

  1. I keep getting this Error: Fingerprint operation canceled.. It happens on the SInfo.setItem because I do see start getting logged. I kinda just followed what it says on the docs. I can’t see why it doesn’t work. This only happens on Android.

  2. On iOS I see the biometrics prompt, but I get nothing from SInfo.getItem

  useEffect(() => {
    async function testingLocalAuthentication() {
      try {
        console.log('start');
        const setData = await SInfo.setItem('key1', 'secretStuff', {
          sharedPreferencesName: 'mySharedPrefs',
          keychainService: 'myKeychain',
          touchID: true, //add this key
          kSecAccessControl: 'kSecAccessControlBiometryAny',
        });
        console.log('------------setData: ', setData);
        const response = await SInfo.getItem('key1', {
          touchID: true,
          showModal: true, //required (Android) - Will prompt user's fingerprint on Android
          strings: {
            // optional (Android) - You can personalize your prompt
            description: 'Custom Title ',
            header: 'Custom Description',
          },
          // required (iOS) -  A fallback string for iOS
          kSecUseOperationPrompt: 'We need your permission to retrieve encrypted data',
        });
        console.log('------------response: ', response);
      } catch (error) {
        console.log(error);
      }
    }
    testingLocalAuthentication();
  });

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Out of curiosity, were you able to fix this on the android emulator by having this in a useEffect or did you do the useCallback as shown in the example app. Just curious.

Using the same useEffect you provided

iOS (Tested on Iphone 11 emulator)

Probably a bug, using your sample code the data couldn’t be retrieved. It always return “undefined”. However, I was able to accomplish that removing the touchId: true from getItem. However, this is not right.

Created a dedicated issue here #233