Base class for interactive authentication credentials. This class should not be instantiated directly; use DeviceCodeCredential or AuthCodeCredential instead.
azr::Credential -> InteractiveCredential
use_refresh_tokenLogical indicating whether to use the login flow (acquire tokens via refresh token exchange).
interactiveLogical indicating whether this credential requires user interaction.
Inherited methods
new()Shared initializer for interactive credentials
InteractiveCredential$new(
scope = NULL,
tenant_id = NULL,
client_id = NULL,
use_cache = "disk",
offline = TRUE,
interactive = TRUE,
use_refresh_token = TRUE,
flow_fun,
req_auth_fun,
oauth_endpoint,
name,
extra_flow_params = list()
)scopeA character string specifying the OAuth2 scope.
tenant_idAzure AD tenant ID.
client_idApplication (client) ID.
use_cacheCache type: "disk" or "memory".
offlineWhether to request offline access (refresh tokens).
interactiveWhether this credential requires user interaction.
use_refresh_tokenWhether to use the login flow (acquire tokens via refresh token
exchange). Set to FALSE to use the access token flow directly.
flow_funThe httr2 OAuth flow function (e.g. httr2::oauth_flow_device).
req_auth_funThe httr2 request auth function (e.g. httr2::req_oauth_device).
oauth_endpointThe OAuth endpoint name passed to the parent credential.
nameThe credential name passed to the parent credential.
extra_flow_paramsA named list of additional parameters merged into
private$.flow_params after scope and auth_url.
is_interactive()Check if the credential requires user interaction
InteractiveCredential$is_interactive()Logical indicating whether this credential is interactive
get_token()Get an access token using the flow configured by the subclass.
Attempts token acquisition in three steps: (1) return a valid cached
token without any interaction; (2) silently refresh using an existing
refresh token; (3) fall back to the configured interactive flow.
When reauth = TRUE all three steps are skipped and the interactive
flow is used directly.
InteractiveCredential$get_token(scope = NULL, reauth = FALSE)scopeA character string specifying the OAuth2 scope. Defaults to
NULL, which uses the scope configured on the credential.
reauthA logical value indicating whether to force
reauthentication, bypassing the cache and silent refresh. Defaults to
FALSE.
An httr2::oauth_token() object containing the access token
req_auth()Add OAuth authentication to an httr2 request using the flow configured by the subclass
InteractiveCredential$req_auth(req)reqAn httr2::request() object
The request object with OAuth authentication configured
clone()The objects of this class are cloneable with this method.
InteractiveCredential$clone(deep = FALSE)deepWhether to make a deep clone.