             self.keychain.remove(Config.keychainUserEmailKey)
             self.keychain.remove(Config.keychainUserIdKey)
             self.keychain.remove(Config.keychainUserPasswordKey)
+            self.logout()
         }
         
         return self.hasCredentials()

                        callback(true, self.token!)
                        
                    } else {
                        callback(false, "An error occuroed.")
                    }
                    
                } else {
                    callback(false, "An error occured.")
                }
            }

                if let json = returnedJson {
                    callback(false, json["message"].string!)
                } else {
                    self.logout()

                    // the user does not exist anymore, so we can delete all
                    // saved credentials
                    if error!.code == 404 {
