The oauth_client() function accepts custom auth functions, but using them results in an object that can't be printed:
library(httr2)
oauth_client(
"example",
"localhost:8080/token",
secret = "secret",
auth = "header"
)
#> <httr2_oauth_client>
#> name: 36788c18332cb6566bf0534e8048fce6
#> id: example
#> secret: <REDACTED>
#> token_url: localhost:8080/token
#> auth: oauth_client_req_auth_header
oauth_client(
"example",
"localhost:8080/token",
auth = function(req, client) {
req_headers(req, `x-auth` = "secret")
}
)
#> <httr2_oauth_client>
#> Error in "cli::cli_dl(redacted)": ! Could not evaluate cli `{}` expression: ` req_headers(re…`.
#> Caused by error in `eval(expr, envir = envir)`:
#> ! object 'req' not found
Created on 2025-01-21 with reprex v2.1.1
The
oauth_client()function accepts customauthfunctions, but using them results in an object that can't be printed:Created on 2025-01-21 with reprex v2.1.1