View source: R/default-credential.R
| get_credential_auth | R Documentation |
Creates a function that retrieves authentication tokens and formats them as HTTP Authorization headers. This function handles credential discovery and returns a callable method that generates Bearer token headers when invoked.
get_credential_auth(
scope = NULL,
tenant_id = NULL,
client_id = NULL,
client_secret = NULL,
use_cache = "disk",
offline = TRUE,
chain = default_credential_chain()
)
scope |
Optional character string specifying the authentication scope. |
tenant_id |
Optional character string specifying the tenant ID for authentication. |
client_id |
Optional character string specifying the client ID for authentication. |
client_secret |
Optional character string specifying the client secret for authentication. |
use_cache |
Character string indicating the caching strategy. Defaults
to |
offline |
Logical. If |
chain |
A list of credential objects, where each element must inherit
from the |
A function that, when called, returns a named list with an
Authorization element containing the Bearer token, suitable for use
with httr2::req_headers().
get_token(), get_request_authorizer(), get_token_provider()
## Not run:
# Create an authentication function
auth_fn <- get_credential_auth(
scope = "https://graph.microsoft.com/.default"
)
# Call it to get headers
auth_headers <- auth_fn()
# Use with httr2
req <- httr2::request("https://graph.microsoft.com/v1.0/me") |>
httr2::req_headers(!!!auth_headers)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.