R/get_config.R

Defines functions get_config

#' Get Config
#'
#' @import httr
#'
#' @param key Yahoo App Key
#' @param secret Yahoo App Secret
#'
#' @return httr config object
#' @export
#'
#' @examples get_config(key, secret)
get_config <- function(key, secret) {
  endpoint <- oauth_endpoint("get_request_token",
                             "request_auth",
                             "get_token",
                             base_url = "https://api.login.yahoo.com/oauth2")

  app <- oauth_app("yahoo",
                   key = key,
                   secret = secret,
                   redirect_uri = "oob")

  token <- oauth2.0_token(endpoint,
                          app,
                          use_oob = T,
                          as_header = T,
                          use_basic_auth = T,
                          cache = T)

  config(token = token)
}
TK2575/fantasyFootballData documentation built on May 17, 2019, 10:37 a.m.