AuthState-class {gargle}R Documentation

Authorization state

Description

An AuthState object manages an authorization state, typically on behalf of a wrapper package that makes requests to a Google API.

The ⁠vignette("gargle-auth-in-client-package)⁠ describes a design for wrapper packages that relies on an AuthState object. This state can then be incorporated into the package's requests for tokens and can control the inclusion of tokens in requests to the target API.

An AuthState should be created through the constructor function init_AuthState(), which has more details on the arguments.

Public fields

package

Package name.

client

An OAuth client.

app

[Deprecated] Use client instead.

api_key

An API key.

auth_active

Logical, indicating whether auth is active.

cred

Credentials.

Methods

Public methods


Method new()

Create a new AuthState

Usage
AuthState$new(
  package = NA_character_,
  client = NULL,
  api_key = NULL,
  auth_active = TRUE,
  cred = NULL,
  app = deprecated()
)
Arguments
package

Package name.

client

An OAuth client.

api_key

An API key.

auth_active

Logical, indicating whether auth is active.

cred

Credentials.

app

[Deprecated] Use client instead.

Details

For more details on the parameters, see init_AuthState()


Method format()

Format an AuthState

Usage
AuthState$format(...)
Arguments
...

Not used.


Method set_client()

Set the OAuth client

Usage
AuthState$set_client(client)
Arguments
client

An OAuth client.


Method set_app()

[Deprecated] Deprecated method to set the OAuth client

Usage
AuthState$set_app(app)
Arguments
app

[Deprecated] Use client instead.


Method set_api_key()

Set the API key

Usage
AuthState$set_api_key(value)
Arguments
value

An API key.


Method set_auth_active()

Set whether auth is (in)active

Usage
AuthState$set_auth_active(value)
Arguments
value

Logical, indicating whether to send requests authorized with user credentials.


Method set_cred()

Set credentials

Usage
AuthState$set_cred(cred)
Arguments
cred

User credentials.


Method clear_cred()

Clear credentials

Usage
AuthState$clear_cred()

Method get_cred()

Get credentials

Usage
AuthState$get_cred()

Method has_cred()

Report if we have credentials

Usage
AuthState$has_cred()

Method clone()

The objects of this class are cloneable with this method.

Usage
AuthState$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


[Package gargle version 1.5.2 Index]