% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/yt_oauth.R
\name{yt_oauth}
\alias{yt_oauth}
\title{Set up Authorization}
\usage{
yt_oauth(
  app_id = NULL,
  app_secret = NULL,
  scope = "analytics",
  token = ".httr-oauth",
  setup_guide = interactive(),
  ...
)
}
\arguments{
\item{app_id}{Client ID from Google Cloud Console; required; no default}

\item{app_secret}{Client secret from Google Cloud Console; required; no default}

\item{scope}{Character. One of:
\itemize{
  \item \code{"analytics"} - Basic analytics data (views, likes, etc.) - Default
  \item \code{"monetary"} - Includes revenue and monetization data
  \item \code{"auto"} - Automatically detect scope based on first API call
}}

\item{token}{Path to file containing the token. Default is \code{.httr-oauth} in working directory.}

\item{setup_guide}{Logical. Show setup guide for first-time users (default: TRUE for interactive sessions)}

\item{\dots}{Additional arguments passed to \code{\link[httr]{oauth2.0_token}}}
}
\value{
Sets the google_token option and saves .httr-oauth in working directory
}
\description{
Simplified OAuth2 setup for YouTube Analytics API. This function will automatically
detect the required scope based on your needs and provide helpful setup guidance.
}
\details{
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.
}
\examples{
 \dontrun{
   # 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)
}
}
\references{
\url{https://developers.google.com/youtube/analytics/reference/}
}
