Learn R Programming

⚠️There's a newer version (2.0.2) of this package.Take me there.

googleAuthR - Google API R Client

Overview

This library allows you to authenticate easily via local use in an OAuth2 flow; within a Shiny app; or via service accounts.

The main two functions are gar_auth() and gar_api_generator().

gar_auth

This takes care of getting the authentication token, storing it and refreshing. Use it before any call to a Google library.

gar_api_generator

This creates functions for you to use to interact with Google APIs. Use it within your own function definitions, to query the Google API you want.

Summary

Auto-build libraries for Google APIs with OAuth2 for both local and Shiny app use.

Get more details at the googleAuthR website

The googleAuthRverse Slack team has been setup for support for using googleAuthR and the libraries it helps create. Sign up via this Google form to get access.

R Google API libraries using googleAuthR

Here is a list of available Google APIs to make with this library. The below libraries are all cross-compatible as they use googleAuthR for authentication backend e.g. can use just one OAuth2 login flow and can be used in multi-user Shiny apps.

Feel free to add your own via email or a pull request if you have used googleAuthR to build something cool.

googleAuthR now has an R package generator which makes R package skeletons you can use to build your own Google API R package upon. Browse through the 154 options at this Github repository.

Example Shiny app

An example shiny app with Google authentication is deployed to shinyapps.io here. It uses the example app that is available in system.file("shiny", package="googleAuthR")

Thanks to

Install

googleAuthR is available on CRAN

install.packages("googleAuthR")

Check out News to see the features of the development version.

If you want to use the development version on Github, install via:

remotes::install_github("MarkEdmondson1234/googleAuthR")

Copy Link

Version

Install

install.packages('googleAuthR')

Monthly Downloads

20,279

Version

0.8.1

License

MIT + file LICENSE

Maintainer

Mark Edmondson

Last Published

July 8th, 2019

Functions in googleAuthR (0.8.1)

gar_auth_service

JSON service account authentication
gar_auto_auth

Perform auto authentication
gar_auth

Authorize googleAuthR
gar_attach_auto_auth

Auto Authentication function for use within .onAttach
gar_cache_get_loc

Setup where to put cache
gar_discovery_apis_list

Get a list of Google API libraries
gar_discovery_api

Get meta data details for specified Google API
gar_check_existing_token

Check a token vs options
gar_gce_auth_email

Get the service email via GCE metadata
gar_set_client

Setup the clientId, clientSecret and scopes
gar_gce_auth

Authenticate on Google Compute Engine
gar_debug_parsing

Read the diagnostic object returned on API parse errors.
doHttrRequest

Get URL content based on if its Shiny or local
checkTokenAPI

Check API data token
gar_create_package

Create a Google API package
gar_gce_auth_default

Authenticate via gcloud's application-default login
gar_batch

Turn a list of gar_fetch_functions into batch functions
gar_auth_jsUI

Shiny JavaScript Google Authorisation [UI Module]
gar_create_api_skeleton

Create an API library skeleton
gar_create_api_objects

Create the API objects from the Discovery API
silent_auth

Silent auth
googleSignIn

Google SignIn [Server Module]
skip_if_no_env_auth

Skip test if not authenticated
token_exists

Check if authorization currently in force
with_shiny

Turn a googleAuthR data fetch function into a Shiny compatible one
gar_batch_walk

Walk data through batches
gar_shiny_auth_url

Make a Google Authorisation URL for Shiny
retryRequest

ReTry API requests for certain errors using exponential backoff.
gar_shiny_auth

Create Authentication within Shiny's server.R
googleSignInUI

Google SignIn [UI Module]
gar_token_info

Get current token summary
gar_shiny_ui

Create a Google login before your Shiny UI launches
gar_shiny_login_ui

A login page for Shiny
get_google_token

Retrieve Google token from environment and configs for httr
googleAuthUI

Shiny Google Authorisation [UI Module]
googleAuth

Shiny Google Authorisation [Server Module]
gar_auth_js

Shiny JavaScript Google Authorisation [Server Module]
googleAuthR

googleAuthR: Easy Authentication with Google OAuth2 APIs
Authentication

R6 environment to store authentication credentials
checkGoogleAPIError

Get Google API errors
gar_api_generator

googleAuthR data fetch function generator
gar_api_page

Takes a generated API function and lets you page through results