adlib_setup <- function()

in R/keyring.R [125:159]


adlib_setup <- function() {
  get_id <- TRUE
  get_secret <- TRUE
  backend_is_env <- keyring_backend_is_env()
  storage_space <- "in your system's secure credential store."

  if (backend_is_env) {
    if (!yesno("Your system does not have a secure credential store. Secrets will be stored as environment variables. Delete them at any time with adlib_clear_setup(). Continue?")) {
      stop("User aborted setup.")
    }
    storage_space <- "as environment variables"
  }

  if (secret_exists(APP_ID)) {
    get_id <- yesno("App ID already set. Overwrite?")
  }

  if (get_id) {
    message(glue::glue("Visit https://developers.facebook.com/ and navigate to your App's basic settings
to find your Application ID and App Secret. These will be stored {storage_space}."))
    readline("Press <Enter> ")
    app_id <- get_pass("Enter your Application ID")
    secret_set(APP_ID, app_id)
  }

  if (secret_exists(APP_SECRET)) {
    get_secret <- yesno("App secret already set. Overwrite?")
  }

  if (get_secret) {
    app_secret <- get_pass("Enter your App secret")
    secret_set(APP_SECRET, app_secret)
  }
  message("Application ID and App secret set. Run adlib_set_longterm_token() to save a long term access token.")
}