---
title: "Proxy Authentication: Username/Password vs IP Whitelisting"
description: "Proxy authentication is how a proxy confirms you may use it: a username and password sent with each connection, or IP whitelisting of approved addresses."
url: "https://rayobyte.com/blog/proxy-authentication/"
author: "Shafayat Hossain"
categories: "Proxies, Proxies for Beginners"
published: "2026-11-30T14:44:07.183Z"
updated: "2026-11-30T14:44:07.183Z"
---

# What Is Proxy Authentication? Username and Password vs IP Whitelisting

Proxy authentication is the check a proxy runs before it forwards your traffic. Providers use a username and password, or IP whitelisting of addresses you register in advance.

Proxy authentication is the check a proxy server runs to confirm that a client is allowed to use it before it forwards any traffic. Proxy providers use two methods: a username and password sent with each connection, or IP whitelisting, where the proxy accepts connections only from IP addresses you registered in advance.

| | Username and password | IP whitelisting |
|---|---|---|
| How the proxy checks you | Credentials in the Proxy-Authorization header (HTTP) or the SOCKS5 login step | The source IP address of your connection is on your approved list |
| What you configure | The credentials in your proxy URL or tool settings | Each machine's public IP address in the provider's dashboard |
| Works when your IP address changes | Yes | No, each new IP address has to be added |
| Secrets in your code | Yes, so store them as environment variables or secrets | None |
| Main risk | Leaked credentials let anyone use your proxies | Anyone sharing your public IP address can use your proxies |
| Good fit | Cloud jobs, autoscaling servers, laptops, many users | Fixed servers and tools with no field for proxy credentials |

## How does proxy authentication work?

Proxy authentication over HTTP works as a challenge and response: the [proxy server](/blog/what-are-proxies/) refuses an unauthenticated request with status 407, and the client sends the request again with credentials.

1. The client sends a request to the proxy without credentials.
2. The proxy answers `407 Proxy Authentication Required` with a `Proxy-Authenticate` header that names the scheme it accepts, usually Basic.
3. The client repeats the request with a `Proxy-Authorization` header that carries the credentials.
4. The proxy checks the credentials and forwards the request, or answers 407 again if they're wrong.

This is the exchange we captured from a test proxy in November 2026:

```http
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: Basic

GET http://127.0.0.1:3000/ HTTP/1.1
Proxy-Authorization: Basic dXNlcjE6cGFzczEyMw==
```

The Basic scheme encodes `username:password` in base64 (`dXNlcjE6cGFzczEyMw==` decodes to `user1:pass123`). [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization) points out that base64 is the same as sending credentials in clear text, because anyone who reads the header can decode it. The `Proxy-Authorization` header is meant for the next proxy on the path: [Fastly's header reference](https://www.fastly.com/documentation/reference/http/http-headers/Proxy-Authorization/) notes that the first proxy that asked for credentials consumes it, so the website never receives your proxy password.

## How does username and password proxy authentication work?

Username and password proxy authentication works by adding your proxy credentials to every connection, most often inside the proxy URL in the form `http://username:password@host:port`. HTTP clients, scraping libraries and browsers read the credentials from that URL and send them in the `Proxy-Authorization` header when the proxy asks.

Credentials travel with the request, not with the machine, so the same proxy login works from a laptop, a cloud function or a fleet of servers whose IP addresses change every deploy. Many providers also read options such as a target country or a session ID from the login, so check your provider's docs for the exact format.

On Rayobyte, the username, password, host and port are in the dashboard under Proxy Access, and the port is 8000. Each product has its own username suffix, such as `-dc` for Premium Rotating Datacenter or `_scale` for Scale Residential, and targeting options go at the end of the password rather than the username, as the [authentication docs](https://docs.rayobyte.com/proxies/authentication/) explain.

## How does IP whitelisting work?

IP whitelisting works by checking the source IP address of each incoming connection against a list of addresses you approved in your provider's dashboard. A connection from a listed address is accepted with no credentials, and a connection from any other address is refused.

IP whitelisting keeps secrets out of your code and works with tools that have no field for proxy credentials. It depends on a stable public IP address, though. Home connections, mobile networks, VPNs and serverless platforms can change your public IP address without warning, and every machine behind the same office or cloud NAT gateway shares one public address, so all of them get access.

On Rayobyte, IP whitelisting is set up in the dashboard under Proxy Access, then IP Authorization. Requests from a whitelisted address send no credentials, so targeting moves into request headers such as `X-Rayobyte-Country: US`. Each product uses one method or the other, and Scale logins support only a username and password.

## Username and password vs IP whitelisting: which should you use?

Username and password authentication suits most setups because it keeps working when your IP address changes, while IP whitelisting suits fixed servers that never move. Use these rules of thumb:

- **Choose username and password** for cloud functions, containers, autoscaling groups, laptops, and teams where each person or project needs its own login.
- **Choose IP whitelisting** for a dedicated server with a static IP address, or a tool that can't send proxy credentials.
- **Store credentials as secrets**, not in source code, and rotate them if they leak.
- **Review your whitelist** when you change hosting, office networks or VPNs, and remove addresses you no longer use.

## How do SOCKS5 proxies authenticate?

SOCKS5 proxies authenticate during the connection handshake, before any traffic flows, rather than with HTTP headers. The client lists the methods it supports and the server picks one. [RFC 1928](https://www.rfc-editor.org/rfc/rfc1928) (March 1996) defines the method codes:

| Code | Method |
|---|---|
| X'00' | No authentication required |
| X'01' | GSSAPI |
| X'02' | Username and password |
| X'FF' | No acceptable methods |

The username and password method is defined in [RFC 1929](https://www.rfc-editor.org/rfc/rfc1929) (March 1996). Usernames and passwords can each be up to 255 bytes, and the RFC warns that the password travels in cleartext. A SOCKS5 proxy that uses IP whitelisting simply answers with method X'00' to approved addresses. Our guide to [SOCKS5 proxies](/blog/what-is-socks-proxy-socks5/) covers the protocol in more depth.

## How do you use an authenticated proxy in curl and Python?

You use an authenticated proxy in curl and Python by putting the credentials in the proxy URL or passing them as a separate option. In curl, use `-x` with the credentials in the URL, or `--proxy-user`:

```bash
curl -x http://user1:pass123@proxy.example.com:8000 https://checkip.amazonaws.com
curl -x http://proxy.example.com:8000 --proxy-user user1:pass123 https://checkip.amazonaws.com
```

In Python, the requests library takes the same URL in its `proxies` dictionary. The response shows the IP address the website sees, which should be the proxy's:

```python
import os
import requests

proxy = f"http://{os.environ['PROXY_USER']}:{os.environ['PROXY_PASS']}@proxy.example.com:8000"
proxies = {"http": proxy, "https": proxy}

r = requests.get("https://checkip.amazonaws.com", proxies=proxies, timeout=10)
print(r.status_code, r.text.strip())
```

We tested both in November 2026 against a local proxy.py 2.4.10 server with Basic authentication and a local test page: requests with no credentials or a wrong password got 407, and requests with the right credentials got 200. With IP whitelisting, drop the `user:pass@` part and use `http://host:port`.

## Why does proxy authentication fail?

Proxy authentication fails most often because the credentials don't reach the proxy in the form it expects, or because your IP address is no longer on the whitelist. Check these first:

- **Special characters in the password**: an `@` or `:` in a password breaks the proxy URL. Percent-encode them (`@` becomes `%40`, `:` becomes `%3A`) or pass the password with `--proxy-user`. In our test, a password with `@` failed in the URL and worked once encoded.
- **Wrong method**: the account expects IP whitelisting but the client sends credentials, or the reverse.
- **Changed public IP address**: a new ISP address, VPN or cloud host means the whitelist no longer matches.
- **Wrong port or protocol**: an HTTP client pointed at a SOCKS5 port, or the reverse, fails before authentication starts, as our guide to [proxy ports](/blog/what-is-a-proxy-port/) explains.

For more fixes, see our guides to [proxy errors](/blog/proxy-error-with-network/) and [proxies that stop working](/blog/web-proxies-stop-working/).

Whichever method you pick, test it against your own setup before you scale up. Rayobyte's [rotating proxies](/products/rotating-proxies/) and [residential proxies](/products/residential-proxies/) start with a free trial.
**Rotating proxies from $0.0080/GB and residential proxies from $0.0095/GB.** [Start free trial](https://app.rayobyte.com/auth/register)

## Frequently asked questions

### Is proxy authentication encrypted?

No, proxy authentication with the Basic scheme is encoded, not encrypted. The username and password are base64-encoded in the Proxy-Authorization header, and anyone who can read the connection to the proxy can decode them. When you browse an HTTPS site through an HTTP proxy, the page traffic inside the tunnel is still encrypted, but the proxy login before it is not.

### Is IP whitelisting safer than a username and password?

IP whitelisting is not automatically safer than a username and password, because each method fails in a different way. IP whitelisting has no secret to leak, but every device that shares your public IP address can use the proxy. A username and password can leak from code, logs or screenshots, so store proxy credentials as secrets and rotate them if they're exposed.

### How do I use special characters in a proxy password?

To use special characters in a proxy password, percent-encode them in the proxy URL: @ becomes %40, : becomes %3A and / becomes %2F. Unencoded, these characters split the URL in the wrong place and the proxy rejects the login. In curl, the --proxy-user option takes the password as typed, with no encoding needed.

### How do I find the IP address to whitelist?

To find the IP address to whitelist, check the public IP address of the machine that will connect to the proxy, not its local address such as 192.168.x.x. Run curl https://checkip.amazonaws.com on that machine, or open an IP lookup site in its browser. Servers behind a NAT gateway or VPN show the gateway's address, and that's the one to add.
