react-native-keychain icon indicating copy to clipboard operation
react-native-keychain copied to clipboard

iOS 15 setInternetCredentials throwing "The user name or passphrase you entered is not correct" error

Open AlexHooperDev opened this issue 3 years ago • 18 comments

Since updating to iOS 15, it seems as if the setInternetCredentials method seems to be throwing an error: Error: The user name or passphrase you entered is not correct. at Object.promiseMethodWrapper [as setInternetCredentialsForServer]

I can understand this error in the context of getInternetCredentials however I am unsure how the username or password could be incorrect when setting a new credential in the keychain.

AlexHooperDev avatar Sep 23 '21 15:09 AlexHooperDev

I'm facing the same problem

reberthkss avatar Sep 28 '21 17:09 reberthkss

I'm hitting the same issue/error since my Xcode version updated the simulators to iOS 15 except I'm using setGenericPassword. Seems like something Apple did something silly.

M-Jas avatar Sep 30 '21 16:09 M-Jas

Facing the same issue, downgrading iOS simulators to iOS 14 does still work. Updated react-native-keychain version urgently needed.

alex7linssen avatar Oct 02 '21 07:10 alex7linssen

@AlexHooperDev Can you confirm this happens in production, not just simulator? There seems to be a bug in iOS 15 Simulator as reported in #510

oblador avatar Oct 03 '21 09:10 oblador

I'm facing this issue on iOS simulators (both 14.5 and 15 versions) as well

I tried my code on test project on real iPad 7 with TouchID (iOS 15). And it works ok there.

But it doesn't work with simulator on iOS 15

RomanSytnyk avatar Oct 04 '21 11:10 RomanSytnyk

@oblador - the issue persists on a physical device (New iPhone 13 running iOS 15 ) however it works fine when running on an iPhone 12 with iOS 15.

AlexHooperDev avatar Oct 05 '21 11:10 AlexHooperDev

Is there any progress on this?

Zachq1r2 avatar Nov 09 '21 03:11 Zachq1r2

Was having the same issue when trying to setGenericPassword, my code was:

      const result = await Keychain.setGenericPassword(
        userName,
        ENV.SECRET_VALUE,
        {
          service: serviceName,
          accessControl: ACCESS_CONTROL.BIOMETRY_ANY,
          accessible: ACCESSIBLE.WHEN_PASSCODE_SET_THIS_DEVICE_ONLY,
        }
      );

then I removed the options object and it started working

      const result = await Keychain.setGenericPassword(
        userName,
        ENV.SECRET_VALUE
      );

OctavianRotari avatar Nov 10 '21 13:11 OctavianRotari

Hi, Im still having same issue here on PROD. on physical devices. If we do what @OctavianRotari suggest is not the best solution, because faceID will open but actually it is not detecting your face as its expected. It just let you in with credentials to any other face in front of camera.

jodavaga avatar Nov 12 '21 17:11 jodavaga

Hey @jodavaga, which key in the options object is the one that controls the behaviour you suggested accessControl or accessible? I've been playing with the options today and the strange behaviour is that if I remove accessControl key it does not work on android but it works on iOS, so as a temporary solution I'm using:

    return Keychain.setGenericPassword(userName, secretValue, {
      service: bundleId,
      accessControl: Platform.OS === "android" ? ACCESS_CONTROL.BIOMETRY_ANY : undefined,
      accessible: ACCESSIBLE.WHEN_PASSCODE_SET_THIS_DEVICE_ONLY,
    });

This issue is only present on the simulator on real device works fine

OctavianRotari avatar Nov 14 '21 12:11 OctavianRotari

I am facing the same issue on iOS 15, has anyone found a solution? @oblador Any updates?

priyeshshah11 avatar Dec 20 '21 23:12 priyeshshah11

Following up on this since my last post. The issue remains for Simulators and devices(personal iPhone 12 mini) running iOS > 15. After doing some general digging posts it seems like the root issue is coming from Apple-land and is still ongoing. Reposting this Apple Developer Forum Issue is hidden amongst the other mentioned issues above and it seems fairly active. Hopefully, it can provide a little more context knowing that we're not alone and the issue is bigger than react-native-keychain.

Sorry, I'm not able to provide any solid workaround or fix for the issue. Simply trying to share some details to prevent future rabbit holes.

M-Jas avatar Jan 11 '22 22:01 M-Jas

Quick Update to my prior comment:

It seems like the recently released iOS version 15.3.1 may have resolved the issue for us. My team and our AB testing group updated our personal devices and simulators and we haven't been able to replicate the issue. We didn't update any code locally or update any other packages that would've patched this issue.

If you have tried updating your devices and simulators yet you might want to give that a try! I'm sorry if this doesn't work for everyone, but I wanted to make sure I updated the thread.

M-Jas avatar Mar 02 '22 18:03 M-Jas

Quick Update to my prior comment:

It seems like the recently released iOS version 15.3.1 may have resolved the issue for us. My team and our AB testing group updated our personal devices and simulators and we haven't been able to replicate the issue. We didn't update any code locally or update any other packages that would've patched this issue.

If you have tried updating your devices and simulators yet you might want to give that a try! I'm sorry if this doesn't work for everyone, but I wanted to make sure I updated the thread.

setGenericPassword still does not work for me after updating to iOS version 15.4 in simulators.

Keychain.setGenericPassword('user', 'pass', { accessControl: Keychain.ACCESS_CONTROL.BIOMETRY_CURRENT_SET_OR_DEVICE_PASSCODE, accessible: Keychain.ACCESSIBLE.WHEN_PASSCODE_SET_THIS_DEVICE_ONLY, })

It does seem to work on actual devices though.

If I remove accessControl from the options, it also works, but that is not very useful.

Does anyone have a solution to this problem?

mmfire118 avatar Mar 16 '22 03:03 mmfire118

Did anyone have any passcode or biometric accessControl options ever working on iOS Simulators? I've hit this issue as well, but it sounds like it might be a dead end. I've bumped into this article:

Note: To test this, you will need to run your code in a real device. Because you can’t set a device passcode in the simulator [...] Source https://www.andyibanez.com/posts/ios-keychain-touch-id-face-id/

The error 'The user name or passphrase you entered is not correct.' is also something we've observed on real devices, when removing passcode or biometrics. Since you can't set a passcode on the simulator, perhaps that's the underlying cause for accessControl options not working.

I've only successfully used biometrics on the Simulator when using a simple "biometric prompt", which does not rely on the passcode.

mstawecki avatar Aug 26 '22 16:08 mstawecki

Any news on this issue?

c-goettert avatar Nov 25 '22 14:11 c-goettert

any update on this issue, facing 'The user name or passphrase you entered is not correct' error on real device. Any help would be appreciated.

I am facing this issue in iphone 11 - ios 17.2 - running on xcode 15.2

getGenericPassword, getAllgenericPassword() works fine in android and simulator ..only it gives this error in ios real device.

@oblador @M-Jas - Kindly help on this

suganyaE3 avatar Mar 26 '24 12:03 suganyaE3

Hey guys, I got the same error when testing in real device: Iphone 13 - iOS 15.4 - xcode 15.0.1

Any update on this issue?

Diegoescalonaro avatar Apr 11 '24 11:04 Diegoescalonaro