Skip to content

make 'oauth_client' more flexible #750

@pedrobtz

Description

@pedrobtz

We have a use case, where depending on the system the code runs, it uses OAuth2 via authorisation flow, device flow or client credentials, with proxy and without proxy. In order to write simple code that works in any of these cases, would it make sense to add 'proxy' argument to 'oauth_client'

oauth_client <- function(

oauth_client <- function(
  id,
  token_url,
  secret = NULL,
  key = NULL,
  auth = c("body", "header", "jwt_sig"),
  auth_params = list(),
  name = hash(id),
  proxy = NULL
) {

Then, in oauth_client_get_token one would do something like

oauth_client_get_token <- function(

if(!is.null(client$proxy))
  req <- req_proxy(req, client$proxy)

We would then create the oauth_client with

client <- oauth_client(
  id = "28acfec0674bb3da9f38",
  token_url = "https://github.com/login/oauth/access_token",
  name = "oauth-test-2",
  proxy = curl::ie_get_proxy_for_url()
)

related #435

At the moment we use AzureAuth and httr::use_proxy.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions