#' POST request to retreive a 3-legged token
#'
#' \code{ct_auth2} 3-Legged authentication with the Citi API
#'
#' For 3-legged authentication with the Citi API. Returns the access token to be
#' passed for subsequent calls.
#'
#' @param
#' @return first get request returns an authorization code
#'
#' @examples
#' ct_token()
#' ct_token()
#'
#' \dontrun{
#'
#' }
ct_auth3 <- function(client_id = NULL) {
# build the inputs for the endpoint
endpoint <- "authCode/oauth2/authorize?"
response <- "response_type=code&"
client <- "scope=accounts_details_transactions&"
scope <- "countryCode=us&"
country <- "businessCode=gcb&"
bc <- "locale=en_US&"
locale <- "state=bdd669c2-1c8e-4e1f-3676-77db2c1647db&"
state <- "redirect_uri=https://google.com"
redirect <- paste0("&client_id=", Sys.getenv("CT_CLIENT_ID"))
httr::GET(url = paste0("https://sandbox.apihub.citi.com/gcb/api/",
endpoint,
response,
client,
scope,
country,
bc,
locale,
state,
redirect),
httr::accept_json()
)
## three leg auth
## GET opens login page for client auth -- pass
## Returns access token in redirect URL
## GET account information using access token
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.