Install
googleAuthR is available on CRAN
If you want to use the development version on Github, install via:
Set up steps
- Create a Google Cloud Project. You will also need billing attached if the API needs it.
- Set up your project in the Google API Console to use the Google API you want:
For local use
- Click ‘Create a new Client ID’, and choose “Installed Application”.
- Download the client JSON file
- 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
- Click ‘Create a new Client ID’, and choose “Web Application”.
- Download the web client JSON file
- 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/
- 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
- 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)
- Run the app locally specifying the port number you used e.g.
shiny::runApp(port=1221)
- Or deploy to your Shiny Server that deploys to web port (80 or 443).
Activate API
- In the Google Cloud Platform Click on “APIs” menu to the left
- Select and activate the API you want to use.
- Go to the documentation and find the API scope URL
- Set option in your R script for the scope via
gar_set_client()