Perform an OAuth credential exchange to obtain a viewer's OAuth access token.
Source:R/get.R
get_oauth_credentials.Rd
Perform an OAuth credential exchange to obtain a viewer's OAuth access token.
Arguments
- connect
A Connect R6 object.
- user_session_token
The content viewer's session token. This token can only be obtained when the content is running on a Connect server. The token identifies the user who is viewing the content interactively on the Connect server.
Read this value from the HTTP header:
Posit-Connect-User-Session-Token
Details
Please see https://docs.posit.co/connect/user/oauth-integrations/#obtaining-a-viewer-oauth-access-token for more information.
Examples
if (FALSE) { # \dontrun{
library(connectapi)
library(plumber)
client <- connect()
#* @get /do
function(req) {
user_session_token <- req$HTTP_POSIT_CONNECT_USER_SESSION_TOKEN
credentials <- get_oauth_credentials(client, user_session_token)
# ... do something with `credentials$access_token` ...
"done"
}
} # }