Search code examples
swifttokenkeychain

Delete a token using Locksmith and Swift 4


I successfully saved a token using Locksmith, but now I want to delete it when the user logs out.

Here is the code that I tried to use to delete the token, but this did not work:

let _ = try? Locksmith.deleteDataForUserAccount(userAccount: "github")

The equivalent using KeychainWrapper would look like this:

let keychainResult = KeychainWrapper.defaultKeychainWrapper.remove(key: KEY_UID)

Solution

  • The API that I was using required a call in order to delete the token.