oblador / react-native-keychain

:key: Keychain Access for React Native
MIT License
3.2k stars 520 forks source link

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

Open AlexHooperDev opened 3 years ago

AlexHooperDev commented 3 years ago

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.

reberthkss commented 3 years ago

I'm facing the same problem

M-Jas commented 3 years ago

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.

alex7linssen commented 3 years ago

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

oblador commented 3 years ago

@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

RomanSytnyk commented 3 years ago

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

AlexHooperDev commented 3 years ago

@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.

Zachq1r2 commented 2 years ago

Is there any progress on this?

OctavianRotari commented 2 years ago

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
      );
jodavaga commented 2 years ago

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.

OctavianRotari commented 2 years ago

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

priyeshshah11 commented 2 years ago

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

M-Jas commented 2 years ago

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 commented 2 years ago

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.

mmfire118 commented 2 years ago

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?

mstawecki commented 2 years ago

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.

c-goettert commented 1 year ago

Any news on this issue?

suganyaE3 commented 7 months ago

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

Diegoescalonaro commented 6 months ago

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?