private async Task <bool> PerformLoginAsync()
        {
            Status = "Attempting to authenticate...";
            _logger.LogInformation("Attempting to authenticate...");
            AuthenticationResult authenticationResult = await _authorizationService.AuthenticateAsync(Username, UseablePassword, AuthenticationCode);

            // Authentication passed, move to home page.
            if (authenticationResult.AuthenticationSuccessful)
            {
                Status = "Authentication was successful.";
                _logger.LogInformation("Authentication was successful.");
                await Task.Delay(1000);

                _logger.LogInformation("Navigating to Home.");
                return(true);
            }

            // Authentication failed.
            _logger.LogInformation("Authentication Failed.");

            // Does it have two-factor authentication?
            if (authenticationResult.OptionHeader != null && authenticationResult.OptionHeader.IsRequired)
            {
                IsAuthenticationCodeRequired = true;

                _logger.LogInformation($"Authentication requires TFA via {authenticationResult.OptionHeader.Type}.");
                switch (authenticationResult.OptionHeader.Type)
                {
                case Models.Headers.GitHubOptionHeaderType.Unknown:
                    Status = "Your GitHub account requires a two factor authentication code that is not currently supported.";
                    break;

                case Models.Headers.GitHubOptionHeaderType.SMS:
                    Status = "Your GitHub account requires a two factor authentication code from your phone.";
                    break;

                case Models.Headers.GitHubOptionHeaderType.AuthenticatorApp:
                    Status = "Your GitHub account requires a two factor authentication code from your Authenticator App.";
                    break;
                }

                return(false);
            }

            // If we get here, all options were exhausted.
            // Either the user did not enter the correct credentials,
            // or there is an unknown problem with their account.
            Status = "Could not authenticate with GitHub. Please be sure you have valid credentials, and that there is nothing wrong with your GitHub account.";
            return(false);
        }
 public Task ExecuteAsync() => _authorizationService.AuthenticateAsync();