Skip to contents

Perform an OAuth credential exchange to obtain a content-specific OAuth access token.

Usage

get_oauth_content_credentials(connect, content_session_token = NULL)

Arguments

connect

A Connect R6 object.

content_session_token

Optional. The content session token. This token can only be obtained when the content is running on a Connect server. The token identifies the service account integration previously configured by the publisher on the Connect server. Defaults to the value from the environment variable: CONNECT_CONTENT_SESSION_TOKEN

Value

The OAuth credential exchange response.

Details

Please see https://docs.posit.co/connect/user/oauth-integrations/#obtaining-a-service-account-oauth-access-token for more information.

Examples

if (FALSE) { # \dontrun{
library(connectapi)
library(plumber)
client <- connect()

#* @get /do
function(req) {
  credentials <- get_oauth_content_credentials(client)

  # ... do something with `credentials$access_token` ...

  "done"
}
} # }