diff --git a/Simperium/Simperium.m b/Simperium/Simperium.m index f4a7a77a..0ae50e80 100644 --- a/Simperium/Simperium.m +++ b/Simperium/Simperium.m @@ -604,9 +604,8 @@ - (void)signOutAndRemoveLocalData:(BOOL)remove completion:(SimperiumSignoutCompl [self stopNetworkManagers]; // Clear the token and user - [self.authenticator reset]; - self.user = nil; - + [self resetAuthToken]; + // Reset the network manager and processors; any enqueued tasks will get skipped self.logoutInProgress = YES; @@ -813,8 +812,7 @@ - (void)authenticationDidCreateAccount - (void)authenticationDidCancel { [self stopNetworkManagers]; - [self.authenticator reset]; - self.user.authToken = nil; + [self resetAuthToken]; [self closeAuthViewControllerAnimated:YES]; if ([self.delegate respondsToSelector:@selector(simperiumDidCancelLogin:)]) { @@ -840,6 +838,11 @@ - (void)authenticationDidFail { [self scheduleOpenAuthViewController]; } +- (void)resetAuthToken { + [self.authenticator reset]; + self.user = nil; +} + - (BOOL)authenticateIfNecessary { if (!self.networkEnabled || !self.authenticationEnabled || !self.appID) { return NO;