get_long_term_access_token <- function()

in R/auth.R [73:86]


get_long_term_access_token <- function(app_secret, app_id, access_token) {
  # docs: https://developers.facebook.com/docs/facebook-login/access-tokens/refreshing
  params <- list(
    grant_type = "fb_exchange_token",
    client_id = app_id,
    client_secret = app_secret,
    fb_exchange_token = access_token
  )
  response <- graph_get("access_token", params, access_token)
  token <- token_from_response(response)
  expiry <- token_expiry(token)
  message(glue::glue("Long-term token successfully obtained. Token expires {expiry}."))
  return(token)
}