httr's use_proxy helper takes the proxy account and authentication scheme together. For a higher-level httr call, the same configuration can be applied around a selected expression:

route <- httr::use_proxy(
  'proxy.example',
  port = 8080,
  username = Sys.getenv('PROXY_USER'),
  password = Sys.getenv('PROXY_PASSWORD'),
  auth = 'ntlm'
)
response <- httr::GET('https://api.example/items', route)

Use ntlm only when the proxy offers that scheme and the installed libcurl build supports it. If the exchange still fails, curl’s NTLM proxy diagnostics explain the challenge, build-support and connection-continuity checks. For a proxy expecting Basic, select auth = 'basic'. Basic is use_proxy's default; providing a Windows-style username alone does not select NTLM.

The helper maps these values to libcurl's proxyuserpwd, proxyport and proxyauth options. The port argument must be numeric.

A 407 concerns the proxy's login. An account supplied for the API through httr::authenticate or an application Authorization header has a different recipient.

Keep the actual proxy endpoint and advertised challenge with the error report, excluding secrets. A wrong account, wrong scheme and unsupported authentication method need different repairs; changing certificate verification does not select among them.

Winndannde jowitiiɗe heen