Get a startup guide by viewing the vignette: vignette("googleAuthR")
If you have many API calls, you can save a lot of time by using batching.
This takes your many calls and sends them in one POST request to www.googleapis.com/batch
,
returning a list of any responses. See gar_batch
for details.
Another common batch task is to call the same function with one parameter changing each call.
This is supported using the gar_batch_walk
function.
If you need Shiny authentication, then these functions work together to give a smooth authentication flow.
googleAuthUI
provides the Shiny UI via Shiny modules
googleAuth
provides the Shiny server via Shiny modules
with_shiny
Wrap the functions you created with gar_api_generator
with this so you can pass the reactiveAccessToken
These are the default options that you can override via options()
googleAuthR.rawResponse = FALSE
googleAuthR.httr_oauth_cache = TRUE
googleAuthR.verbose = 3
googleAuthR.client_id = "201908948134-rm1ij8ursrfcbkv9koc0aqver84b04r7.apps.googleusercontent.com"
googleAuthR.client_secret = "nksRJZ5K3nm9FUWsAtBoBArz"
googleAuthR.webapp.client_id = "201908948134-cjjs89cffh3k429vi7943ftpk3jg36ed.apps.googleusercontent.com"
googleAuthR.webapp.client_secret = "mE7rHl0-iNtzyI1MQia-mg1o"
googleAuthR.webapp.port = 1221
googleAuthR.jsonlite.simplifyVector = TRUE
googleAuthR.scopes.selected = c("https://www.googleapis.com/auth/webmasters",
"https://www.googleapis.com/auth/analytics",
"https://www.googleapis.com/auth/analytics.readonly",
"https://www.googleapis.com/auth/analytics.manage.users.readonly",
"https://www.googleapis.com/auth/tagmanager.readonly",
"https://www.googleapis.com/auth/urlshortener")
googleAuthR.ok_content_types=c("application/json; charset=UTF-8", ("text/html; charset=UTF-8"))
googleAuthR.securitycode = paste0(sample(c(1:9, LETTERS, letters), 20, replace = T), collapse='')
googleAuthR.tryAttempts = 5
There are two main functions in the googleAuthR package:
gar_auth
provides local authentication token.
gar_api_generator
A function factory for easy enabling of Google API functions.