get_oauth_content_credentials: Perform an OAuth credential exchange to obtain a...

View source: R/get.R

get_oauth_content_credentialsR Documentation

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

Description

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

Details

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

Value

The OAuth credential exchange response.

Examples

## Not run: 
library(connectapi)
library(plumber)
client <- connect()

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

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

  "done"
}

## End(Not run)


rstudio/connectapi documentation built on Dec. 20, 2024, 1:48 p.m.