         guard status != errSecItemNotFound else { throw WMFKeychainCredentialsError.noValue }
         guard status == noErr else { throw WMFKeychainCredentialsError.unhandledError(status: status) }
         guard
-            let data = result as? Data,
+            let dictionary = result as? [String: Any],
+            let data = dictionary[kSecValueData as String] as? Data,
             let value = String(data: data, encoding: String.Encoding.utf8)
         else {
             throw WMFKeychainCredentialsError.unexpectedData
         }
+        
+        // update accessibility of value from kSecAttrAccessibleWhenUnlocked to kSecAttrAccessibleAfterFirstUnlock
+        if let attrAccessible = dictionary[kSecAttrAccessible as String] as? String, attrAccessible == (kSecAttrAccessibleWhenUnlocked as String)  {
+            try? update(value: value, forKey: key)
+        }
+        
         return value
     }
     

        var dataDict = [String : AnyObject]()
        let valueData = value.data(using: String.Encoding.utf8)
        dataDict[kSecValueData as String] = valueData as AnyObject?
        let status = SecItemUpdate(query as CFDictionary, dataDict as CFDictionary)
        if (status != errSecSuccess) {
            throw WMFKeychainCredentialsError.unhandledError(status: status)

        var query = commonConfigurationDictionary(forKey: key)
        let valueData = value.data(using: String.Encoding.utf8)
        query[kSecValueData as String] = valueData as AnyObject?
        query[kSecAttrAccessible as String] = kSecAttrAccessibleAfterFirstUnlock
        
        let status = SecItemAdd(query as CFDictionary, nil)

        guard status != errSecSuccess else {
