inst/doc/get-api-credentials.R

## ---- include = FALSE---------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----eval = FALSE-------------------------------------------------------------
#  library(googlesheets4)
#  
#  gs4_auth_configure(api_key = "YOUR_API_KEY_GOES_HERE")
#  gs4_deauth()
#  
#  # now you can read public resources, such as official example Sheets,
#  # without any need for auth
#  gs4_example("gapminder") %>%
#    read_sheet()

## ---- eval = FALSE------------------------------------------------------------
#  library(googledrive)
#  
#  google_client <- gargle::gargle_oauth_client_from_json(
#    path = "/path/to/the/JSON/that/was/downloaded/from/gcp/console.json",
#    name = "acme-corp-google-client"
#  )
#  drive_auth_configure(app = google_client)
#  
#  # now any new OAuth tokens are obtained with the configured client

## ----eval = FALSE-------------------------------------------------------------
#  # googledrive
#  drive_auth(path = "/path/to/your/service-account-token.json")

Try the gargle package in your browser

Any scripts or data that you put into this service are public.

gargle documentation built on July 26, 2023, 5:29 p.m.