--- title: "Google API Setup" author: "Mark Edmondson" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Google API Setup} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ## Install googleAuthR is available on CRAN ```r install.packages("googleAuthR") ``` If you want to use the development version on Github, install via: ```r remotes::install_github("MarkEdmondson1234/googleAuthR") ``` ## Set up steps 1. Create a Google Cloud Project. You will also need billing attached if the API needs it. 2. Set up your project in the Google API Console to use the Google API you want: ## For local use 3. Click 'Create a new Client ID', and choose "Installed Application". 4. Download the client JSON file 5. Set the `GAR_CLIENT_JSON` environment argument (via `.Renviron` or otherwise) to the full path file location of the JSON file (see `gar_set_client()` for other options) ## For Shiny use 3. Click 'Create a new Client ID', and choose "Web Application". 4. Download the web client JSON file 5. Add the URL of where your Shiny app will run to the credentials, with no port number. e.g. `https://your-account.shinyapps.io/your-shiny-app/` 6. And/Or also put in localhost or 127.0.0.1 with a port number for local testing. Remember the port number you use as you will need it later to launch the app e.g. `http://127.0.0.1:1221` 7. Set the `GAR_CLIENT_WEB_JSON` environment argument (via `.Renviron` or otherwise) to the full path file location of the JSON file (see `gar_set_client()` for other options) 8. Run the app locally specifying the port number you used e.g. `shiny::runApp(port=1221)` 9. Or deploy to your Shiny Server that deploys to web port (80 or 443). # Activate API 1. In the Google Cloud Platform Click on "APIs" menu to the left 2. Select and activate the API you want to use. 3. Go to the documentation and find the API scope URL 4. Set option in your R script for the scope via `gar_set_client()`