This uses oauth_flow_bearer_jwt()
to generate an access token which is then
used to authenticate the request with req_auth_bearer_token()
.
The token is cached in memory.
Arguments
- req
A request.
- client
An
oauth_client()
.- claim
A list of claims. If all elements of the claim set are static apart from
iat
,nbf
,exp
, orjti
, provide a list andjwt_claim()
will automatically fill in the dynamic components. If other components need to vary, you can instead provide a zero-argument callback function which should calljwt_claim()
.- signature
Function use to sign
claim
, e.g.jwt_encode_sig()
.- signature_params
Additional arguments passed to
signature
, e.g.size
,header
.- 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")
claim <- jwt_claim()
req <- request("https://example.com")
req %>% req_oauth_bearer_jwt(client, claim)
#> <httr2_request>
#> GET https://example.com
#> Body: empty
#> Policies:
#> • auth_oauth: a list