View source: R/trackdown_auth.R
trackdown_auth_configure | R Documentation |
These functions give more control over and visibility into the auth
configuration than trackdown_auth()
does. trackdown_auth_configure()
lets the user specify their own:
OAuth client, which is used when obtaining a user token.
See the vignette("get-api-credentials", package = "gargle")
for more.
If the user does not configure these settings, internal defaults
are used.
trackdown_oauth_client()
retrieves the currently configured OAuth client.
trackdown_auth_configure(client, path, app = deprecated())
trackdown_oauth_client()
client |
A Google OAuth client, presumably constructed via
|
path |
JSON downloaded from Google Cloud Console, containing a client id and
secret, in one of the forms supported for the |
app |
trackdown_auth_configure()
: An object of R6 class
gargle::AuthState, invisibly.
trackdown_oauth_client()
: the current user-configured OAuth client.
Other auth functions:
trackdown_auth()
,
trackdown_deauth()
# see the current user-configured OAuth client (probaby `NULL`)
trackdown_oauth_client()
if (require(httr)) {
# store current state, so we can restore
original_client <- trackdown_oauth_client()
# bring your own client via client id (aka key) and secret
google_client <- gargle::gargle_oauth_client(
id = "123456789.apps.googleusercontent.com",
secret = "abcdefghijklmnopqrstuvwxyz",
name = "my-awesome-google-api-wrapping-package",
)
trackdown_auth_configure(client = google_client)
# confirm current client
trackdown_oauth_client()
# restore original state
trackdown_auth_configure(client = original_client)
trackdown_oauth_client()
}
## Not run:
# bring your own client via JSON downloaded from Google Developers Console
trackdown_auth_configure(
path = "/path/to/the/JSON/you/downloaded/from/google/dev/console.json"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.