Skip to content

This uses oauth_flow_client_credentials() to generate an access token, which is then used to authentication the request with req_auth_bearer_token(). The token is cached in memory.

Usage

req_oauth_client_credentials(req, client, scope = NULL, token_params = list())

Arguments

req

A request.

client

An oauth_client().

scope

Scopes to be requested from the resource owner.

token_params

List containing additional parameters passed to the token_url.

Value

A modified HTTP request.

Examples

client <- oauth_client("example", "https://example.com/get_token")
req <- request("https://example.com")

req %>% req_oauth_client_credentials(client)
#> <httr2_request>
#> GET https://example.com
#> Body: empty
#> Policies:
#>auth_oauth: a list