gm_auth_configure {gmailr} | R Documentation |
Edit auth configuration
Description
See the article Set up an OAuth client for
instructions on how to get an OAuth client. Then you can use
gm_auth_configure()
to register your client for use with gmailr.
gm_oauth_client()
retrieves the currently configured OAuth client.
Usage
gm_auth_configure(
client = NULL,
path = gm_default_oauth_client(),
key = deprecated(),
secret = deprecated(),
appname = deprecated(),
app = deprecated()
)
gm_oauth_client()
Arguments
client |
A Google OAuth client, presumably constructed via
|
path |
JSON downloaded from Google Cloud Console, containing a client id and
secret, in one of the forms supported for the |
key , secret , appname , app |
Use the
|
Value
-
gm_auth_configure()
: An object of R6 class gargle::AuthState, invisibly. -
gm_oauth_client()
: the current user-configured OAuth client.
See Also
gm_default_oauth_client()
to learn how you can make your OAuth
client easy for gmailr to discover.
Other auth functions:
gm_auth()
,
gm_deauth()
,
gm_scopes()
,
gmailr-configuration
Examples
# if your OAuth client can be auto-discovered (see ?gm_default_oauth_client),
# you don't need to provide anything!
gm_auth_configure()
# see and store the current user-configured OAuth client
(original_client <- gm_oauth_client())
# the preferred way to configure your own client is via a JSON file
# downloaded from Google Developers Console
# this example JSON is indicative, but fake
path_to_json <- system.file(
"extdata", "client_secret_installed.googleusercontent.com.json",
package = "gargle"
)
gm_auth_configure(path = path_to_json)
# confirm that a (fake) OAuth client is now configured
gm_oauth_client()
# restore original auth config
gm_auth_configure(client = original_client)