gargle (version 0.1.3)

init_AuthState: Create an AuthState

Description

Constructor function for objects of class AuthState.

Usage

init_AuthState(package = NA_character_, app, api_key, auth_active)

Arguments

package

Package name, an optional string. The associated package will generally by implied by the namespace within which the AuthState is defined. But it's possible to record the package name explicitly and seems like a good practice.

app

An OAuth consumer application, as produced by httr::oauth_app().

api_key

API key (a string). Necessary in order to make unauthorized "token-free" requests for public resources. Can be NULL if all requests will be authorized, i.e. they will include a token.

auth_active

Logical. TRUE means requests should include a token (and probably not an API key). FALSE means requests should include an API key (and probably not a token).

Value

An object of class AuthState.

Examples

Run this code
# NOT RUN {
init_AuthState(
  package = "mypkg",
  app = gargle_app(),
  api_key = gargle_api_key(),
  auth_active = TRUE
)
# }

Run the code above in your browser using DataLab