Skip to contents

Retrieves the current token for Secret Manager. If authentication is active (.sm_auth$auth_active is TRUE) and no token is cached, it will trigger sm_auth() to obtain one.

This function is typically used by other package functions that make API requests.

Usage

sm_token()

Value

An httr::config object containing the httr::Token2.0 object, or NULL if auth is inactive.

Examples

if (FALSE) { # \dontrun{
# Configure auth first if needed (e.g., with your client ID)
# sm_auth_configure(path = "path/to/client.json")
# sm_auth() # or let it be called automatically

token <- sm_token()
if (!is.null(token)) {
  # Use token in httr::GET() or other API calls
}
} # }