Skip to contents

This creates or grabs a token to authorize API requests

Usage

youtube_oauth(
  clientId = NULL,
  clientSecret = NULL,
  tokenFile = ".httr-oauth",
  useOOB = FALSE,
  setEnvVar = FALSE,
  scopes = c("https://www.googleapis.com/auth/youtube.readonly",
    "https://www.googleapis.com/auth/yt-analytics.readonly"),
  reAuthOnFail = FALSE
)

Arguments

clientId

Required. Client Id obtained from console.cloud.google.com.

clientSecret

Required. Client Secret obtained from console.cloud.google.com

tokenFile

The name of the token httr-oauth file to read the token from. If the file does not exist then one will be created with the provided name.

useOOB

If TRUE, use oob method to copy/paste token into R.

setEnvVar

If TRUE, create an environment variable called "YouTube_Token" to store token.

scopes

Scopes that must be passed when authenticating. See https://developers.google.com/youtube/analytics/reference for more information.

reAuthOnFail

If TRUE, will automatically begin authentication process if provided token is expired.

Value

token environment

Examples

if (FALSE) { # \dontrun{
youtube_oauth("123456789asdalksdjfhaslkdjfb.apps.googleusercontent.com",
              "MasdfH5320208ladshf790",
              token = ".httr-oauth-myToken")
} # }