Skip to contents

This function checks whether valid credentials are available either in the provided auth object or in the global auth credentials object.

Usage

khis_has_cred(auth = NULL)

Arguments

auth

(Optional) An auth object containing DHIS2 credentials. If not provided, the function will check the global auth object for credentials.

Value

A boolean value indicating whether valid credentials are available.

See also

Other credential functions: khis_base_url(), khis_cred(), khis_cred_clear(), khis_display_name(), khis_username()

Examples


if (FALSE) { # \dontrun{
    # Set the credentials using global .auth object
    khis_cred(username = 'DHIS2 username',
              password = 'DHIS2 password',
              server = 'https://dhis2-instance/api')

    # Check if credentials are available. Should return TRUE
    khis_has_cred()

    # Clear global credentials
    khis_cred_clear()

    # Check if credentials are available. Should return FALSE
    khis_has_cred()
} # }