/// <summary> /// Logs out the currently logged in user session. This will remove the session from disk, log out of /// linked services, and future calls to <see cref="CurrentUser"/> will return <c>null</c>. /// /// This is preferable to using <see cref="LogOut()"/>, unless your code is already running from a /// background thread. /// </summary> public static Task LogOutAsync(CancellationToken cancellationToken) { return(GetCurrentUserAsync().OnSuccess(t => { LogOutWithProviders(); ParseUser user = t.Result; if (user == null) { return Task.FromResult(0); } return user.taskQueue.Enqueue(toAwait => user.LogOutAsync(toAwait, cancellationToken), cancellationToken); }).Unwrap()); }