R/sf_connect.R

sf_connect <- function(host, user, password, token) {
  if(is.null(host))
    stop('host is NULL.')

  if(is.null(user))
    stop("user is NULL")

  if(is.null(password))
    stop("password is NULL")



  pw <- paste0(password,token)
  apiVersion <- "26.0"
  con <- rforcecom.login(username, pw, host, apiVersion)

  #Check if we got an response
  if(length(con) != 3) {
    stop(paste0("Cannot connect to host:", host))
  }

  #Return
  con

}
rgustavs/tidySalesforce documentation built on May 8, 2019, 6:55 p.m.