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.
client: A Google OAuth client, presumably constructed via gargle::gargle_oauth_client_from_json(). Note, however, that it is preferred to specify the client with JSON, using the path argument.
path: JSON downloaded from Google Cloud Console, containing a client id and secret, in one of the forms supported for the txt argument of jsonlite::fromJSON() (typically, a file path or JSON string).
key, secret, appname, app: Use the path (strongly recommended) or client argument instead.
Returns
gm_auth_configure(): An object of R6 class gargle::AuthState , invisibly.
gm_oauth_client(): the current user-configured OAuth client.
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 fakepath_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 configuredgm_oauth_client()# restore original auth configgm_auth_configure(client = original_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