private async Task DoLogin(Func <AuthenticationResult, Task> onSuccess) { _vm.LoggingIn(); var authenticationResult = await _authenticationService.Authenticate(); if (authenticationResult != null && !authenticationResult.IsError) { _user.Initialize(authenticationResult); await onSuccess(authenticationResult); } else { _vm.AllowLogin(); } }