Skip to content

How to set up proxy credentials? #478

Open
@marcioggs

Description

@marcioggs

Hi.

I'm using the library to call but the company I work for has a proxy that requires credentials.
How do I set up the credentials?

I already set up the default ProxySelector, which the library is using:

ProxySelector.setDefault(ProxySelector.of(new InetSocketAddress("host", 9999)));

I also set up the default Authenticator, but its method is not executed when I try to interact with the API using the library methods, which results in HTTP error 407 Proxy Authentication Required:

    Authenticator.setDefault(
        new Authenticator() {
          @Override
          protected PasswordAuthentication getPasswordAuthentication() {
            if (getRequestorType() == RequestorType.PROXY) {
              return new PasswordAuthentication("proxyUsername", "proxyPassword".toCharArray());
            }
            return null;
          }
        });

Thanks for your attention.

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