Skip to contents

Request an OpenID Connect identity token suitable for workload identity federation with a third-party service.

Usage

connect_workload_token(
  ...,
  content_token = Sys.getenv("CONNECT_CONTENT_SESSION_TOKEN"),
  server_url = Sys.getenv("CONNECT_SERVER"),
  api_key = Sys.getenv("CONNECT_API_KEY")
)

has_workload_token(...)

Arguments

...

Further arguments passed on to connect_workload_token().

content_token

A token that uniquely identifies this content session. Defaults to the value of the CONNECT_CONTENT_SESSION_TOKEN environment variable, which is set automatically when running on Connect.

server_url

The Connect server to exchange credentials with. Defaults to the value of the CONNECT_SERVER environment variable, which is set automatically when running on Connect.

api_key

An API key for the Connect server. Defaults to the value of the CONNECT_API_KEY environment variable, which is set automatically when running on Connect.

Value

connect_workload_token() returns an httr2::oauth_token.

has_workload_token() returns TRUE if a workload identity token is available and FALSE otherwise.

Details

connect_workload_token() handles caching automatically.

Examples

integration_guid <- "891db041-22d6-4f5f-9fee-fc715a33929e"
token <- "default-token"
if (has_workload_token(audience = integration_guid)) {
  token <- connect_workload_token(audience = integration_guid)
}