| Gargle-class {gargle} | R Documentation |
OAuth2 token objects specific to Google APIs
Description
Gargle2.0 is based on the Token2.0 class provided in
httr. The preferred way to create a Gargle2.0 token is through the
constructor function gargle2.0_token(). Key differences with Token2.0:
The key for a cached
Token2.0comes from hashing the endpoint, client, and scopes. For theGargle2.0subclass, the identifier or key is expanded to include the email address associated with the token. This makes it easier to work with Google APIs with multiple identities.-
Gargle2.0tokens are cached, by default, at the user level, following the XDG spec for storing user-specific data and cache files. In contrast, the default location forToken2.0is./.httr-oauth, i.e. in current working directory.Gargle2.0behaviour makes it easier to reuse tokens across projects and makes it less likely that tokens are accidentally synced to a remote location like GitHub or DropBox. Each
Gargle2.0token is cached in its own file. The token cache is a directory of such files. In contrast,Token2.0tokens are cached as components of a list, which is typically serialized to./.httr-oauth.
Super classes
httr::Token -> httr::Token2.0 -> Gargle2.0
Public fields
emailEmail associated with the token.
packageName of the package requesting a token. Used in messages.
clientAn OAuth client.
Methods
Public methods
Inherited methods
Method new()
Create a Gargle2.0 token
Usage
Gargle2.0$new( email = gargle_oauth_email(), client = gargle_client(), package = "gargle", credentials = NULL, params = list(), cache_path = gargle_oauth_cache(), app = deprecated() )
Arguments
emailOptional email address. See
gargle2.0_token()for full details.clientAn OAuth consumer application.
packageName of the package requesting a token. Used in messages.
credentialsExists largely for testing purposes.
paramsA list of parameters for the internal function
init_oauth2.0(), which is a modified version ofhttr::init_oauth2.0(). gargle actively usesscopeanduse_oob, but does not useuser_params,type,as_header(hard-wired toTRUE),use_basic_auth(accept default ofuse_basic_auth = FALSE),config_init, orclient_credentials.cache_pathSpecifies the OAuth token cache. Read more in
gargle_oauth_cache().app
Returns
A Gargle2.0 token.
Method format()
Format a Gargle2.0 token
Usage
Gargle2.0$format(...)
Arguments
...Not used.
Method print()
Print a Gargle2.0 token
Usage
Gargle2.0$print(...)
Arguments
...Not used.
Method hash()
Generate the email-augmented hash of a Gargle2.0 token
Usage
Gargle2.0$hash()
Method cache()
Put a Gargle2.0 token into the cache
Usage
Gargle2.0$cache()
Method load_from_cache()
(Attempt to) get a Gargle2.0 token from the cache
Usage
Gargle2.0$load_from_cache()
Method refresh()
(Attempt to) refresh a Gargle2.0 token
Usage
Gargle2.0$refresh()
Method init_credentials()
Initiate a new Gargle2.0 token
Usage
Gargle2.0$init_credentials()
Method clone()
The objects of this class are cloneable with this method.
Usage
Gargle2.0$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.