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

19,316

Version

0.7.0

License

MIT + file LICENSE

Maintainer

Mark Edmondson

Last Published

November 16th, 2018

Functions in googleAuthR (0.7.0)

Authentication

R6 environment to store authentication credentials
checkGoogleAPIError

Get Google API errors
gar_batch

Turn a list of gar_fetch_functions into batch functions
checkTokenAPI

Check API data token
gar_create_package

Create a Google API package
doHttrRequest

Get URL content based on if its Shiny or local
gar_batch_walk

Walk data through batches
gar_discovery_apis_list

Get a list of Google API libraries
googleAuth

Shiny Google Authorisation [Server Module]
gar_api_generator

googleAuthR data fetch function generator
gar_api_page

Takes a generated API function and lets you page through results
gar_discovery_api

Get meta data details for specified Google API
gar_token_info

Get current token summary
gar_gce_auth

Authenticate on Google Compute Engine
gar_shiny_auth

Create Authentication within Shiny's server.R
gar_cache_get_loc

Setup where to put cache
get_google_token

Retrieve Google token from environment and configs for httr
gar_check_existing_token

Check a token vs options
gar_auth_service

JSON service account authentication
gar_auth_jsUI

Shiny JavaScript Google Authorisation [UI Module]
gar_auto_auth

Perform auto authentication
googleAuthUI

Shiny Google Authorisation [UI Module]
gar_shiny_auth_url

Make a Google Authorisation URL for Shiny
googleAuthR

googleAuthR: Easy Authentication with Google OAuth2 APIs
silent_auth

Silent auth
gar_create_api_objects

Create the API objects from the Discovery API
gar_auth_js

Shiny JavaScript Google Authorisation [Server Module]
gar_shiny_login_ui

A login page for Shiny
gar_shiny_ui

Create a Google login before your Shiny UI launches
googleSignIn

Google SignIn [Server Module]
googleSignInUI

Google SignIn [UI Module]
gar_create_api_skeleton

Create an API library skeleton
gar_gce_auth_email

Get the service email via GCE metadata
skip_if_no_env_auth

Skip test if not authenticated
retryRequest

ReTry API requests for certain errors using exponential backoff.
gar_set_client

Setup the clientId, clientSecret and scopes
token_exists

Check if authorization currently in force
with_shiny

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

Authorize googleAuthR
gar_attach_auto_auth

Auto Authentication function for use within .onAttach