R/get.R
get_oauth_credentials.Rd
Perform an OAuth credential exchange to obtain a viewer's OAuth access token.
get_oauth_credentials(connect, user_session_token)
A Connect R6 object.
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
The OAuth credential exchange response.
Please see https://docs.posit.co/connect/user/oauth-integrations/#obtaining-a-viewer-oauth-access-token for more information.
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"
}
} # }