get_oauth_credentials | R Documentation |
Perform an OAuth credential exchange to obtain a viewer's OAuth access token.
get_oauth_credentials(connect, user_session_token)
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: |
Please see https://docs.posit.co/connect/user/oauth-integrations/#obtaining-a-viewer-oauth-access-token for more information.
The OAuth credential exchange response.
## Not run:
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"
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.