khis_cred {khisr} | R Documentation |
Sets DHIS2 Credentials
Description
khis_cred()
sets the credentials for accessing a DHIS2 instance.
Usage
khis_cred(
username = NULL,
password = NULL,
server = NULL,
api_version = NULL,
config_path = NULL,
base_url = deprecated()
)
Arguments
username |
The DHIS2 username. Only required if configuration file not provided. |
password |
The DHIS2 password. Only required if configuration file not provided. |
server |
The server URL of the DHIS2 instance. Only required if configuration file not provided. |
api_version |
The API version of the DHIS2 instance (optional). |
config_path |
An optional path to a configuration file containing username and password. This is considered more secure than providing credentials directly in code. |
base_url |
Deprecated. The base URL of the DHIS2 instance. Use |
Details
This function allows you to set the credentials for interacting with a DHIS2 server. You can either provide the username and password directly (less secure) or specify a path to a configuration file containing these credentials. Using a configuration file is recommended for improved security as it prevents credentials from being stored directly in your code.
Value
Auth object
See Also
Other credential functions:
khis_base_url()
,
khis_cred_clear()
,
khis_display_name()
,
khis_has_cred()
,
khis_username()
Examples
## Not run:
# Option 1: Using a configuration file (recommended)
# Assuming a configuration file named "credentials.json":
khis_cred(config_path = "path/to/credentials.json")
# Option 2: Providing credentials directly (less secure)
khis_cred(username = "your_username",
password = "your_password",
base_url='https://dhis2-instance/api')
## End(Not run)