cred_funs | R Documentation |
Functions to query or manipulate the registry of credential functions
consulted by token_fetch()
.
cred_funs_list()
cred_funs_add(...)
cred_funs_set(funs, ls = deprecated())
cred_funs_clear()
cred_funs_list_default()
cred_funs_set_default()
local_cred_funs(
funs = cred_funs_list_default(),
action = c("replace", "modify"),
.local_envir = caller_env()
)
with_cred_funs(
funs = cred_funs_list_default(),
code,
action = c("replace", "modify")
)
... |
< |
funs |
A named list of credential functions. |
ls |
|
action |
Whether to use
|
.local_envir |
The environment to use for scoping. Defaults to current execution environment. |
code |
Code to run with temporary credential function registry. |
A list of credential functions or NULL
.
cred_funs_list()
: Get the list of registered credential functions.
cred_funs_add()
: Register one or more new credential fetching functions.
Function(s) are added to the front of the list. So:
"First registered, last tried."
"Last registered, first tried."
Can also be used to remove a function from the registry.
cred_funs_set()
: Register a list of credential fetching functions.
cred_funs_clear()
: Clear the credential function registry.
cred_funs_list_default()
: Return the default list of credential functions.
cred_funs_set_default()
: Reset the registry to the gargle default.
local_cred_funs()
: Modify the credential function registry in the current
scope. It is an example of the local_*()
functions in withr.
with_cred_funs()
: Evaluate code
with a temporarily modified credential
function registry. It is an example of the with_*()
functions in
withr.
token_fetch()
, which is where the registry is actually used.
names(cred_funs_list())
creds_one <- function(scopes, ...) {}
cred_funs_add(one = creds_one)
cred_funs_add(two = creds_one, three = creds_one)
names(cred_funs_list())
cred_funs_add(two = NULL)
names(cred_funs_list())
# restore the default list
cred_funs_set_default()
# remove one specific credential fetcher
cred_funs_add(credentials_gce = NULL)
names(cred_funs_list())
# force the use of one specific credential fetcher
cred_funs_set(list(credentials_user_oauth2 = credentials_user_oauth2))
names(cred_funs_list())
# restore the default list
cred_funs_set_default()
# run some code with a temporary change to the registry
# creds_one ONLY
with_cred_funs(
list(one = creds_one),
names(cred_funs_list())
)
# add creds_one to the list
with_cred_funs(
list(one = creds_one),
names(cred_funs_list()),
action = "modify"
)
# remove credentials_gce
with_cred_funs(
list(credentials_gce = NULL),
names(cred_funs_list()),
action = "modify"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.