gar_auth_service: JSON service account authentication

View source: R/auth.R

gar_auth_serviceR Documentation

JSON service account authentication


As well as OAuth2 authentication, you can authenticate without user interaction via Service accounts. This involves downloading a secret JSON key with the authentication details.

To use, go to your Project in the

and select JSON Key type. Save the file to your computer and call it via supplying the file path to the json_file parameter.

Navigate to it via: Google Dev Console > Credentials > New credentials > Service account Key > Select service account > Key type = JSON


gar_auth_service(json_file, scope = getOption("googleAuthR.scopes.selected"))



the JSON file downloaded from Google Developer Console


Scope of the JSON file auth if needed


(Invisible) Sets authentication token

See Also

Other authentication functions: gar_attach_auto_auth(), gar_auth(), gar_auto_auth(), gar_gce_auth(), get_google_token(), token_exists()

googleAuthR documentation built on April 11, 2023, 6 p.m.