Consults the token cache for a suitable OAuth token and, if unsuccessful, gets a token via the browser flow. A cached token is suitable if it's compatible with the user's request in this sense:
OAuth app must be same.
Scopes must be same.
Email, if provided, must be same.
gargle is very conservative about using OAuth tokens discovered in the user's
cache and will generally seek interactive confirmation. Therefore, in a
non-interactive setting, it's important to explicitly specify the
of the target account or to explicitly authorize automatic discovery. See
gargle2.0_token(), which this function wraps, for more. Non-interactive use
also suggests it might be time to use a service account token.
A character vector of scopes to request. Pick from those listed at https://developers.google.com/identity/protocols/googlescopes.
For certain token flows, the
An OAuth consumer application, created by
Name of the package requesting a token. Used in messages.
Arguments passed on to
A Gargle2.0 token.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
## Not run: ## Drive scope, built-in gargle demo app scopes <- "https://www.googleapis.com/auth/drive" credentials_user_oauth2(scopes, app = gargle_app()) ## bring your own app app <- httr::oauth_app( appname = "my_awesome_app", key = "keykeykeykeykeykey", secret = "secretsecretsecret" ) credentials_user_oauth2(scopes, app) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.