req_oauth_client_credentials: OAuth authentication with client credentials

Description Usage Arguments Value Examples

View source: R/oauth-flow-client-credentials.R

Description

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

1
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

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

req %>% req_oauth_client_credentials(client)

httr2 documentation built on Sept. 28, 2021, 5:10 p.m.