khis_cred {khisr} | R Documentation |
Sets DHIS2 Credentials
Description
khis_cred()
sets the credentials for accessing a DHIS2 instance.
Usage
khis_cred(
config_path = NULL,
username = NULL,
password = NULL,
base_url = deprecated()
)
Arguments
config_path |
An optional path to a configuration file containing username and password. This is considered more secure than providing credentials directly in code. |
username |
The DHIS2 username. Only required if configuration file not provided. |
password |
The DHIS2 password. Only required if configuration file not provided. |
base_url |
The base URL of the DHIS2 instance. Only required if configuration file not provided. |
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
No return value
See Also
Other credential functions:
khis_cred_clear()
,
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)