gc_auth: Authorize requests to the Google Calendar API

Description Usage Arguments Details Value Examples

Description

Authorizes this package to interact with your Google Calendars. You will be automatically directed to a web browser, asked to sign in to your Google account, and prompted to grant permission for the package to interact with the Google Calendar service.

Usage

1
2
3
4
gc_auth(new_user = FALSE, key = getOption("googlecalendar.client_key"),
  secret = getOption("googlecalendar.client_secret"),
  cache = getOption("googlecalendar.oauth_cache"), token = NULL,
  verbose = FALSE)

Arguments

new_user

Logical indicating whether to reauthorize using a new account and remove the current cached credentials. Currently, only one account can be authorized or cached in a directory at a time.

key, secret

Client key and secret for the application. See below for more information on setting these in an .Rprofile file.

cache

Logical indicating whether to cache credentials in a .httr-oauth file in the working directory.

token

Token object or the name of a token object .rds file to be set in the credentialing environment. This is most useful for authentication in a non-interactive setting.

verbose

Logical indicating whether to print informative messages.

Details

Typically, users will not need to call this function explicitly, as the authorization process will be triggered by the first action that requires a user login. However, before using googlecalendar, the client credentials key and secret should be predefined in an .Rprofile file using:

1
2
3
4
5
options(
  googlecalendar.client_key = "<KEY>",
  googlecalendar.client_secret = "<SECRET>",
  googlecalendar.oauth_cache = TRUE
)

Note that the default value of cache may also be specified in the .Rprofile file using googlecalendar.oauth_cache. The recommended value is TRUE.

For more information on obtaining these credentials, see the project README on GitHub or visit the Google API Console to get started registering an application.

Value

An OAuth token object.

Examples

1
2
3
4
5
6
## Not run: 
gs_auth()
gs_auth(token = readRDS("saved_token.rds"))
gs_auth(token = "saved_token.rds")

## End(Not run)

benjcunningham/googlecalendar documentation built on May 12, 2019, 11:56 a.m.