Getting "User interaction is not allowed." error while fetching data from the keychain

Hi,

We are getting error while fetching data from the keychain.

Error code : "-25308"

Error message : "User interaction is not allowed."

This is happening in our Production app and many users are facing this issue. This issue is coming randomly for random users. Its working fine but suddenly we are getting this error randomly.

We have tried to add delay when keychain is giving error randomly to minimise the issue but it is not fixing our issue and What could be the reason of this issue

Can we have dedicated support for this?

Thank You.

First up, I want to point you at the following posts:

These explain the backstory that I’m going to assume.

I also want to point you at Investigating hard-to-reproduce keychain problems. This outlines the general process that I recommend for investigating problems like this.

Error code : "-25308"

This is errSecInteractionNotAllowed. Assuming that you’re on iOS [1] or one of its child platforms, this has a pretty straightforward explanation: You’re accessing a keychain item that’s locked in some way. Typically this means that:

  • You’re accessing a keychain item that’s gated by data protection [2] and protected data isn’t available at this time. For example, the item might have the data protection set to kSecAttrAccessibleWhenUnlocked and you’re accessing it when the device is locked.

  • You’re accessing a keychain item protected by biometrics when user interaction isn’t possible, for example, when your app is in the background.

My experience is that issues like this almost always boil down to your app running code in the background unexpectedly. For example, you might have adding keychain support to your networking code and, heretofore, it’s only run in the foreground. You then add some background execution feature to your app — or you had an existing background feature but now the OS is running it in the background more often — and now you’re keychain code this this issue.

There are two ways you can approach debugging this:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] If you’re not, first read TN3137 On Mac keychain APIs and implementations and then write back here, because the situation on the Mac is more complex.

[2] kSecAttrAccessible or, equivalently, kSecAttrAccessControl where you set the protection on the SecAccess object.

Getting "User interaction is not allowed." error while fetching data from the keychain
 
 
Q