gar_set_client: Setup the clientId, clientSecret and scopes

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/set_client.R

Description

Help setup the client ID and secret with the OAuth 2.0 clientID. Do not confuse with Service account keys.

Usage

1
2
gar_set_client(json = Sys.getenv("GAR_CLIENT_JSON"),
  web_json = Sys.getenv("GAR_CLIENT_WEB_JSON"), scopes = NULL)

Arguments

json

The file location of an OAuth 2.0 client ID json file

web_json

The file location of client ID json file for web applications

scopes

A character vector of scopes to set

Details

This function helps set the options(googleAuthR.client_id), options(googleAuthR.client_secret) and options(googleAuthR.scopes.selected) for you.

You can also set the web application client IDs that are used in Shiny authentication, that are set via the options options(googleAuthR.webapp.client_id), options(googleAuthR.webapp.client_secret)

Note that if you authenticate with a cache token with different values it will overwrite them.

For successful authentication, the API scopes can be browsed via the googleAuthR RStudio addin or the Google API documentation.

Do not confuse this JSON file with the service account keys, that are used to authenticate a service email. This JSON only sets up which app you are going to authenticate with - use gar_auth_service with the Service account keys JSON to perform the actual authentication.

By default the JSON file will be looked for in the location specified by the "GAR_CLIENT_JSON" environment argument, or via "GAR_CLIENT_WEB_JSON" for webapps.

Value

The project-id the app has been set for

Author(s)

Idea via @jennybc and @jimhester from gargle and gmailr libraries.

See Also

https://console.cloud.google.com/apis/credentials

Examples

1
2
3
4
5
6
## Not run: 

gar_set_client("google-client.json", scopes = "http://www.googleapis.com/auth/webmasters")
gar_auth_service("google-service-auth.json")

## End(Not run)

googleAuthR documentation built on June 21, 2018, 5:05 p.m.