# NOT RUN {
# see and store the current user-configured OAuth app (probaby `NULL`)
(original_app <- drive_oauth_app())
# see and store the current user-configured API key (probaby `NULL`)
(original_api_key <- drive_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"
drive_auth_configure(app = google_app, api_key = google_key)
# confirm the changes
drive_oauth_app()
drive_api_key()
}
# }
# NOT RUN {
# bring your own app via JSON downloaded from Google Developers Console
drive_auth_configure(
path = "/path/to/the/JSON/you/downloaded/from/google/dev/console.json"
)
# }
# NOT RUN {
# restore original auth config
drive_auth_configure(app = original_app, api_key = original_api_key)
# }
Run the code above in your browser using DataLab