OAuth2 icon indicating copy to clipboard operation
OAuth2 copied to clipboard

Failed to store tokens to keychain: Error Domain=swift.keychain.error Code=-34018

Open akabab opened this issue 9 years ago • 8 comments
trafficstars

If I turn Keychain Sharing ON it works, but am I really supposed to do that?

akabab avatar Oct 03 '16 10:10 akabab

Please see #130.

p2 avatar Oct 03 '16 19:10 p2

This doesn't give me an answer, I'm still forced to activate Keychain Sharing to avoid -34018 error

akabab avatar Oct 13 '16 09:10 akabab

This seems to be a recurring problem with Xcode and simulator, see here: http://stackoverflow.com/questions/20344255/secitemadd-and-secitemcopymatching-returns-error-code-34018-errsecmissingentit/24120485#24120485

Are you also getting the same issue on device?

p2 avatar Oct 13 '16 09:10 p2

I'm not having the issue on device (tried only with iOS9 not 10), but still I have to keep it activated for developing purpose (through simulator..)

akabab avatar Oct 13 '16 09:10 akabab

I know, I have the same issue, but this is a problem with Xcode/Simulator. I'll keep this open for the error code -34018 specifically.

p2 avatar Oct 13 '16 10:10 p2

I got a problem with the keychain and I saw the various issues that references to this one so I am trying here.

I get this output when running forgetTokens():

[Debug] OAuth2: Forgetting tokens and removing them from keychain
[Warn!] OAuth2: Failed to delete tokens from keychain: Error Domain=swift.keychain.error Code=-25300 "(null)"

I use the OAuth2PasswordGrant and I checked that I only have one instance of it. It doesn't matter if I set keychain to false or true, the access- and refresh token are not persisted and it keeps throwing the above error.

I am using Xcode 10.0 with Swift 4.2 and version 4.0.1 of the framework integrated using Carthage. Keychain sharing is turned off since I don't want the limitions of that, but I briefly tried to turn it on and run it again, but it didn't help.

Does anyone know what could be wrong?

anfriis avatar Oct 29 '18 12:10 anfriis

Anyone? @p2 ?

anfriis avatar Nov 05 '18 09:11 anfriis

I was using obtainAccessToken() directly instead of using authorize() which then skips the part where it persists the tokens in the keychain. So I couldn't forget the tokens because they never got there...

anfriis avatar Nov 25 '18 20:11 anfriis