# see and store the current user-configured OAuth app (probaby `NULL`)
(original_app <- gar_oauth_app())
# see and store the current user-configured API key (probaby `NULL`)
(original_api_key <- gar_api_key())
if (require(httr)) {
# bring your own app via client id (aka key) and secret
google_app <- httr::oauth_app(
"my-awesome-google-api-wrapping-package",
key = "123456789.apps.googleusercontent.com",
secret = "abcdefghijklmnopqrstuvwxyz"
)
google_key <- "the-key-I-got-for-a-google-API"
gar_auth_configure(app = google_app, api_key = google_key)
# confirm the changes
gar_oauth_app()
gar_api_key()
}
if (FALSE) {
## bring your own app via JSON downloaded from Google Developers Console
gar_auth_configure(
path = "/path/to/the/JSON/you/downloaded/from/google/dev/console.json"
)
}
# restore original auth config
gar_auth_configure(app = original_app, api_key = original_api_key)
Run the code above in your browser using DataLab