Sets or retrieves authentication credentials for the current R session.
Supports both long-lived API keys (maxar-api-key) and OAuth2 Bearer tokens
(Authorization: Bearer <token>) with automatic refresh when expired.
Usage
vantor_auth(
api_key = NULL,
username = NULL,
password = NULL,
token = NULL,
refresh_token = NULL,
verbose = getOption("vantorr.verbose", TRUE)
)Arguments
- api_key
Character string. A Vantor/Maxar API key.
- username
Character string. Email address for OAuth2 authentication.
- password
Character string. Password for OAuth2 authentication.
- token
Character string. An existing OAuth2 access token.
- refresh_token
Character string. An existing OAuth2 refresh token.
- verbose
Logical. Print status messages. Defaults to
getOption("vantorr.verbose", TRUE).
Value
Invisibly returns a list representing the active authentication state,
or NULL if no credentials could be resolved.
Details
By default, vantor_auth() checks the following environment variables if
arguments are not explicitly supplied:
VANTOR_API_KEYorMAXAR_API_KEYVANTOR_USERNAMEorMAXAR_USERNAMEVANTOR_PASSWORDorMAXAR_PASSWORD
Note
Authentication Scope Across Vantor Endpoints:
OGC & Non-Administrative APIs (
get_maxar_wms_basemap(),get_maxar_wms_tiles(),vantor_get_seamlines()): Accept either an API key (maxar-api-key) or an OAuth2 Bearer token.Browser-Based
leafletTile Layers (add_vantor_basemap(),add_vantor_seamlines(),add_vantor_imagery(),vantor_wmts_url()): Require an API key (maxar_api_keyURL query parameter).Account Services / Admin APIs (
vantor_get_usage()): Require an OAuth2 Bearer token (usernameandpassword, ortoken). Per the Vantor API specification, Admin APIs do not accept API keys.
Examples
# Check if credentials are configured in the environment
vantor_has_auth(verbose = FALSE)
#> [1] FALSE
# Set an API key for the current session
vantor_auth(api_key = "your_api_key_here", verbose = FALSE)
# Clear session credentials
vantor_auth_clear(verbose = FALSE)