httr2
httr2 copied to clipboard
req_oauth_bearer_jwt requires claim twice
I've found that to use req_oauth_bearer_jwt the jwt_claim needs to be passed in two instances for httr2 to not error.
It needs to be
- in the function it self (else function errors with "claim missing with no default")
- in the client auth_params (else errors with "client needs jwt_claim in auth_params when using jwt_sig")
Is it really necessary to pass the claim twice, or should not the claim be passed from the client to the function (like the "key" parameter is)?
claim <- jwt_claim()
httr2::req_oauth_bearer_jwt(
claim = claim,
client = meetupr_client(
key = "/path/to/key.pem",
auth = "jwt_sig",
auth_params = list(
claim = claim
)
)
)
Definitely sounds like a bug to me. Do you want to have a go at a PR? I have literally no recollection of how this code works, but presumably you just need to pass claim somewhere extra.
I'll have a look and see what I can figure out. Would you prefer the claim to come from the client or the other way around?