All locations active · 99.99% uptime
Proxy Guide

Proxy Authentication Methods

Access to a paid proxy service is opened in one of two ways: either you send a username and password with every request, or you register your public IP address in the provider's dashboard and create a whitelist (allow list). Both solve the same problem — "does this connection really belong to the subscriber?" — but they produce very different results in daily use.

In this article we cover how the two methods work at the protocol level, which one is right in which scenario and the error codes you will encounter.

Method 1: Username and Password

In this method the credentials are sent to the proxy on every connection. The format changes depending on the protocol:

  • HTTP proxy: Proxy-Authorization: Basic <base64(username:password)> header is added.
  • SOCKS5: the username/password sub-negotiation defined in RFC 1929 is performed; the username and password are sent in binary form.

On the HTTP side the flow is as follows: the client sends a request without credentials, the proxy responds with 407 Proxy Authentication Required , and the client adds the credentials and repeats the request.

FIGUREHTTP proxy authentication handshake
FLOWClientProxyCONNECT target.com:443 HTTP/1.1407 Proxy Authentication RequiredProxy-Authenticate: Basic realm="proxy"Proxy-Authorization: Basic a3VsbGFuaWNpOnNpZnJl200 Connection establishedTunnel opened, data can flow

Most clients perform these two round trips automatically. curl and browsers add the credentials and repeat the request when they see a 407; simple HTTP libraries, on the other hand, sometimes do not retry and return an error straight away.

Important

Basic method does not encryptthe credentials, it only encodes them with Base64. Base64 is a reversible encoding. That is why the confidentiality of the credentials depends on the connection to the proxy itself being secure.

Method 2: IP Whitelist

In the whitelist model there is no password. You add your own public IP address in the provider's dashboard; the proxy only accepts connections coming from that address. Since no credentials are carried, the client side becomes very simple: curl -x http://proxy.example.com:8080 https://example.com is enough.

The crucial question for this model is this: is your public IP address static? On most home internet connections the IP is dynamic and changes when the modem restarts. When it changes, the whitelist becomes invalid and all connections are refused.

FIGUREComparison of username/password and IP whitelist
COMPARISONUsername / passwordIP whitelistPortabilityWorks from any networkOnly from the registered IPClient complexityCredentials requiredZero configurationDynamic IPUnaffectedBreaks when the IP changesLeak riskThe password can be stolenNo secret to stealMultiple usersAn account per personHard to tell apartServer / VPSSuitableIdeal — static IPMobile / travelIdealImpractical

The choice largely comes down to the question "do you have a static IP?". A whitelist is more suitable for automation running on a server, and a username/password for roaming use.

Which One in Which Scenario?

01

A scraper or bot running on a server

Your VPS's IP is static; choose a whitelist. Credentials are not embedded in the code or in environment variables, and the leak surface shrinks. For automation scenarios this is the default we recommend.

02

Manual use from a laptop

If you move between the office, home and a café, your IP changes constantly. Use a username/password; it works without problems from any network.

03

Shared use within a team

If you need to answer the question of who used how much traffic, create a separate user per person. With a whitelist the whole team appears under a single identity.

04

Multiple profiles with an antidetect browser

If each profile is to be assigned a different exit IP, a username/password is mandatory, because session selection is usually encoded inside the username (for example user-session-a1).

Embedding Session Information in the Username

There is a common pattern in residential pools: the username is not only an identity, it also carries a command . For example:

FIGUREThe anatomy of a username that carries parameters
ANATOMYcustomer-country-de-session-a91f-ttl-10mcustomerAccount identifier — billing looks at this fieldcountry-deExit country: Germanysession-a91fSticky session keyttl-10mThe lifetime of the session

The separator character and the parameter names vary from provider to provider. Go by the documentation in your dashboard; the format here is only meant to show the structure.

The advantage of this design is that no API call is needed on the client side: you change country or session simply by changing the username. The disadvantage is that the credentials get longer and typos lead to silent changes in behaviour. Rotating proxy logic is explained in our article, where we cover in detail how this model affects session management.

Common Errors

FIGUREAuthentication-related errors and their solutions
ERROR MAPCODE / SYMPTOMLIKELY CAUSESOLUTION407 Proxy AuthenticationRequiredThe credentials were never sent, or they are wrongCheck the username/password; make sure the client retriesafter the 407The connection closessilentlyAn unsupported authentication method in SOCKS5Make sure the client offers the username/passwordmethod403 ForbiddenConnecting from outside the IP whitelistAdd your current public IP address in the dashboardThe browser keeps askingfor the passwordThe credentials are not stored in the sessionSwitch to a whitelist or use a local bridge proxyThe password breaks on aspecial characterAn @ or : character not encoded inside the URLWrite the password with percent encoding (@ → 40%)

The difference between 407 and 403 is critical: 407 says "show me your identity", while 403 means "I have seen your identity, you are not authorised".

The Special Character Trap

When you write credentials in URL form, some characters in the password get mixed up with the separators. http://user:p@ss@ip:8080 in this expression, the second @ is taken for the separator and the connection cannot be established. The solution is percent encoding:

CharacterEncoded formCharacterEncoded form
@%40/%2F
:%3A#%23
?%3F%%25

A more robust approach is to give the credentials in the client's separate fields instead of embedding them in the URL. Python requests, Node undici and curl's --proxy-user option support this.

FIGUREProviding credentials without embedding them in the URL
Examples01# curl — the password is not in the URL but in a separate option02curl -x http://proxy.example.com:8080 --proxy-user "username:password" https://example.com0304# Python requests — read from the environment variables05import os, requests06user = os.environ["PROXY_USER"]; pw = os.environ["PROXY_PASS"]07proxies = {"http": f"http://{user}:{pw}@proxy.example.com:8080",08 "https": f"http://{user}:{pw}@proxy.example.com:8080"}09r = requests.get("https://example.com", proxies=proxies, timeout=20)1011# Node.js — undici ProxyAgent12import { ProxyAgent, request } from "undici";13const agent = new ProxyAgent({ uri: "http://proxy.example.com:8080",14 token: "Basic " + Buffer.from(`${process.env.PROXY_USER}:${process.env.PROXY_PASS}`).toString("base64") });

Reading the credentials from an environment variable instead of embedding them in the code both prevents them from leaking into version control and makes rotation easier.

What Changes from a Security Perspective?

The two methods carry different risks. In the username/password model the secret can be stolen: a command line that ends up in a log file, a configuration file that slips into version control or a screenshot is enough. In the whitelist model there is no secret, but there is a risk of IP sharing : everyone on the same office network can use your proxy without even realising it.

The most robust configuration is to combine the two: narrow the source with a whitelist and add a username/password on top. Most corporate providers support this hybrid model. On the privacy side, if you are wondering what the proxy sees, our is a proxy safe article offers a comprehensive framework; for leak tests DNS leak and WebRTC leak tools.

Practical Rules for Credential Management

  • Use environment variables, do not write them inside the code.
  • Create separate credentials for each environment : development, test and production should not share the same password.
  • Define quotas and limits; a leaked credential should not be able to consume unlimited traffic.
  • Rotate them regularly; always change them after someone leaves the team.
  • Mask them in the logs; debug output should not print the password in plain text.

Summary

An IP whitelist is the cleanest solution with the lowest leak risk on servers with a static IP. A username and password, on the other hand, are indispensable for roaming use and scenarios that require multiple sessions. To decide, it is enough to answer the questions "is my IP static", "how many people will use it" and "do I need to send a session parameter". To test your configuration you can use proxy checker tool , and you can verify your exit IP with My IP Address .

Frequently Asked Questions

01Which is more secure, an IP whitelist or a username/password?

With a whitelist there is no secret that can be stolen, and in that respect it is more secure. However, it cannot tell the other devices on the same network apart. The strongest configuration is to use both together: the whitelist narrows the source, the password verifies the person.

02I am getting a 407 error but my username is correct, why?

The three most common reasons: a special character in the password not being encoded inside the URL, the client not repeating the request after a 407, and the credentials not being sent during the CONNECT stage on HTTPS requests. Test with curl using --proxy-user first.

03I have a dynamic IP, can I use a whitelist?

You can, but you have to update the dashboard every time your IP changes. Some providers allow the whitelist to be updated via API; you can automate this with a small script. Even so, a username/password is more practical in this scenario.

04Do I have to add a session parameter to the username?

No, this is simply a design preferred by some residential providers. As an alternative, there are also services that offer port-based session selection or session management via an API.

05Why does the browser keep asking for the proxy password?

Browsers store proxy credentials for the duration of the session; they forget them when you close the browser. For a permanent solution you need to switch to an IP whitelist or run a local bridge proxy that carries the password.

Related Articles and Pages

NEXT STEP

Strengthen your proxy setup today.

Get started in minutes with a paid plan, or try our free proxy list first.

FREEPROXY.TR

Looking for a free proxy? You're in the right place

A complete proxy platform where you can browse up-to-date free proxy addresses, compare HTTP and SOCKS proxy types, and check your proxy connections with free tools.