private void handleAuthFollowUpClicked()

in plugin/src/software/aws/toolkits/eclipse/amazonq/views/AmazonQChatViewActionHandler.java [177:207]


    private void handleAuthFollowUpClicked(final AuthFollowUpClickedParams params) {
        String incomingType = params.authFollowupType();
        String fullAuth =  AuthFollowUpType.FULL_AUTH.getValue();
        String reAuth = AuthFollowUpType.RE_AUTH.getValue();
        String missingScopes = AuthFollowUpType.MISSING_SCOPES.getValue();
        String useSupportedAuth = AuthFollowUpType.USE_SUPPORTED_AUTH.getValue();

        try {
            if (incomingType.equals(reAuth) || incomingType.equals(missingScopes)) {
                boolean loginOnInvalidToken = true;
                Activator.getLoginService().reAuthenticate(loginOnInvalidToken).get();
                return;
            }
        } catch (Exception ex) {
            PluginUtils.showErrorDialog("Amazon Q", Constants.RE_AUTHENTICATE_FAILURE_MESSAGE);
            throw new AmazonQPluginException("Failed to re-authenticate when auth follow up clicked", ex);
        }

        try {
            if (incomingType.equals(fullAuth) || incomingType.equals(useSupportedAuth)) {
                Activator.getLoginService().logout();
                return;
            }
        } catch (Exception ex) {
            PluginUtils.showErrorDialog("Amazon Q", Constants.AUTHENTICATE_FAILURE_MESSAGE);
            throw new AmazonQPluginException("Failed to authenticate when auth follow up clicked", ex);
        }

        PluginUtils.showErrorDialog("Amazon Q", Constants.AUTHENTICATE_FAILURE_MESSAGE);
        throw new AmazonQPluginException("Error occured while attempting to handle auth follow up: Unknown AuthFollowUpType " + incomingType);
    }