plug_get_valid_token {plug} | R Documentation |
Get a valid token for Plug API
Description
This function checks if a valid global token exists for the Plug API. If no valid token is found,
it generates a new token using the stored global credentials by sending a properly formatted request.
If it fails to retrieve the token (for example, due to missing credentials or network issues),
it will not throw an error but will display a message in English ("No valid credentials found.") and return NULL
.
Usage
plug_get_valid_token(
validity_time = 3600,
endpoint = "https://plug.der.pe.gov.br/MadrixApi/authenticate/"
)
Arguments
validity_time |
The validity period of the token in seconds. Default is 3600 (1 hour). |
endpoint |
The endpoint URL for generating the token. |
Value
The valid token as a string, or NULL
if no valid credentials were found or an error occurred.
Examples
## Not run:
token <- plug_get_valid_token(validity_time = 3600)
## End(Not run)
[Package plug version 0.1.0 Index]