Skip to content

OAuth clients with custom auth functions can't be printed #648

@atheriel

Description

@atheriel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions