Skip to contents

Set an API credential for this session or save it for future sessions

Usage

set_api_token(
  token,
  scheme = NULL,
  persist = FALSE,
  file = Sys.getenv("R_ENVIRON_USER", unset = path.expand("~/.Renviron"))
)

Arguments

token

Credential supplied by the user. Never put it in tracked files.

scheme

Security scheme name; optional when only one is configured.

persist

Save to a user environment file when TRUE. Defaults to session only.

file

Environment file used when persist is TRUE. Defaults to R_ENVIRON_USER when set, otherwise the user home .Renviron. A project .Renviron may take precedence.

Value

Invisibly NULL. The token is never printed or returned.

Details

Saved credentials are plain text. Existing unrelated lines are preserved. No environment file is read or written when the package loads.