| yt_oauth | R Documentation |
Simplified OAuth2 setup for YouTube Analytics API. This function will automatically detect the required scope based on your needs and provide helpful setup guidance.
yt_oauth(
app_id = NULL,
app_secret = NULL,
scope = "analytics",
token = ".httr-oauth",
setup_guide = interactive(),
...
)
app_id |
Client ID from Google Cloud Console; required; no default |
app_secret |
Client secret from Google Cloud Console; required; no default |
scope |
Character. One of:
|
token |
Path to file containing the token. Default is |
setup_guide |
Logical. Show setup guide for first-time users (default: TRUE for interactive sessions) |
... |
Additional arguments passed to |
The function looks for .httr-oauth in the working directory. If it doesn't find it, it expects an application ID and a secret. The function launches a browser to allow you to authorize the application.
Sets the google_token option and saves .httr-oauth in working directory
https://developers.google.com/youtube/analytics/reference/
## Not run:
# Basic setup (will show setup guide first time)
yt_oauth("your-client-id.apps.googleusercontent.com", "your-client-secret")
# Setup with monetary scope for revenue data
yt_oauth("your-client-id.apps.googleusercontent.com", "your-client-secret",
scope = "monetary")
# Skip setup guide
yt_oauth("your-client-id.apps.googleusercontent.com", "your-client-secret",
setup_guide = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.