nxtbgthng / OAuth2Client

Client library for OAuth2 (currently built against draft 10 of the OAuth2 spec)
855 stars 217 forks source link

Crash while fetching from keychain #188

Open Spacelapp opened 9 years ago

Spacelapp commented 9 years ago

Any option to disable account storing in the keychain?

Here's the crash: Application Specific Information: *\ Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unexpected error while fetching accounts from keychain: 4294941988'

Best regards, Lukas

toto commented 9 years ago

No, and it does not feel like a good idea to do that. Can you investigate the cause of the crash?

Spacelapp commented 9 years ago

Maybe because of this -> http://stackoverflow.com/questions/10536859/ios-keychain-not-retrieving-values-from-background/10583042#10583042

sirnacnud commented 9 years ago

I am running in to this same problem. I have a Today Widget extension that can update when the phone is locked and it makes a call to retrieve the accounts. I have been able to fix the assert by adding kSecAttrAccessibleAfterFirstUnlock, kSecAttrAccessible to the query for the Keychain item. I would create a pull request, but just adding this attribute will break keychain functionality for people already using the library. This is because the query is modified, so the old keychain item can't be deleted or retrieved with the new query. It seems like we would need to add some kind of update method that adds the kSecAttrAccessible attribute to the existing keychain entry and then the new query should work.

senryxie commented 8 years ago

Any clue about this 4294941988 error code? I just find the same issue from my App. It's already using kSecAttrAccessibleAfterFirstUnlock for kSecAttrAccessible.

krunalbhavsar commented 7 years ago

I also facing same error: *\ Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unexpected error while fetching accounts from keychain: 4294941988'

shorbenko commented 7 years ago

4294941988 is not the right error code value. This number is a result of usage %zd format during error printing. The correct value is -25308. errSecInteractionNotAllowed = -25308, /* User interaction is not allowed. */ You can check it by running following lldb command:

(lldb) po [NSString stringWithFormat:@"%zd",-25308]
4294941988
adeadman commented 7 years ago

I fixed it in my app by adding the "Keychain Access" entitlement under the Project settings->Targets, choosing the Capabilities tab. This allows it to work in iOS 10.1.