Skip to content
proxiesauthenticationsecurity

Proxy Authentication: IP Whitelist vs User/Pass vs API

Compare proxy authentication methods: IP whitelisting, username/password, and API tokens. Covers security trade-offs, setup complexity, and when to use each.

Proxy authentication determines how the proxy server verifies that you're authorized to route traffic through it. The three common methods — IP whitelisting, username/password, and API tokens — each have real trade-offs in security, flexibility, and ease of integration. Picking the wrong one for your setup can mean either security holes or constant authentication failures.

The Three Methods Compared

FactorIP WhitelistUsername/PasswordAPI Token
Setup complexityLowLowMedium
Works from dynamic IPsNoYesYes
Works from cloud/serverlessOnly if IP is staticYesYes
Credential rotationChange IP listChange passwordRotate token
Per-request customizationNoneUsername modifiersQuery params
Protocol supportHTTP/HTTPS/SOCKS5HTTP/HTTPS/SOCKS5HTTP only (REST)
Shared team accessAdd each member's IPShare credentialsPer-user tokens
Security if credential leaksN/A — IP-boundFull access until changedRevoke single token

IP Whitelisting

IP whitelisting authorizes traffic based on the source IP of the connection to the proxy server. You register your server's IP address in the proxy dashboard, and any request from that IP goes through without additional credentials.

How It Works

Code example
Your Server (IP: 203.0.113.50)
    │
    ├── Connects to proxy gateway
    │   Gateway checks: Is 203.0.113.50 whitelisted? ✓
    │
    └── Request routed through residential IP

Setup

ProxyLabs residential plans do not use IP whitelisting. The dashboard gives you a username and password, and a request without them is rejected. Providers that do offer a whitelist accept a request with no credentials once the source IP is registered:

bash
# Shape used by providers that whitelist the source IP. Not a ProxyLabs residential login.
curl -x http://proxy.example:8080 https://httpbin.org/ip

When IP Whitelisting Works Well

  • Dedicated servers: Your scraping server has a static IP that never changes. Whitelist it once and forget about it.
  • Simple scripts: No need to handle credentials in code — reduces the chance of accidentally committing passwords to git.
  • High-throughput pipelines: No auth header overhead (though this is microseconds — not a real performance factor).

When IP Whitelisting Fails

  • Home connections: Most ISPs assign dynamic IPs. Your whitelist breaks when the IP changes (could be daily or weekly).
  • Cloud functions: AWS Lambda, Google Cloud Functions, and Vercel Edge Functions don't have predictable IPs. Whitelisting entire CIDR ranges is insecure.
  • Laptop development: Your IP changes every time you switch networks (office, home, coffee shop).
  • Team environments: Every developer needs their IP whitelisted. Someone's IP changes, scraper breaks at 2 AM.

The Dynamic IP Problem

A whitelist is tied to the IP that opens the connection. When that IP changes, the list is stale until someone updates it. ProxyLabs does not offer a customer whitelist API. The username and password from the dashboard keep working when your source IP changes.

Username/Password Authentication

The most common method for residential proxies. You include credentials in each proxy request, either in the URL or via the Proxy-Authorization header.

How It Works

Code example
Your Server (any IP)
    │
    ├── Connects to proxy gateway
    │   Sends: Proxy-Authorization: Basic base64(username:password)
    │   Gateway validates credentials ✓
    │
    └── Request routed through residential IP

Basic Usage

bash
# cURL
curl -x http://your-username:[email protected]:8080 https://httpbin.org/ip

# With country targeting via username modifier
curl -x http://your-username-country-us:[email protected]:8080 https://httpbin.org/ip
python
import requests

# Rotating proxy
proxy = {
    'http': 'http://your-username:[email protected]:8080',
    'https': 'http://your-username:[email protected]:8080',
}

# Geo-targeted + sticky session
proxy_sticky_gb = {
    'http': 'http://your-username-country-gb-ttl-3600-session-sess01:[email protected]:8080',
    'https': 'http://your-username-country-gb-ttl-3600-session-sess01:[email protected]:8080',
}

The Killer Feature: Username Modifiers

Username/password auth enables per-request customization through username modifiers. This is why most scraping setups prefer it — you can control geo-targeting, session persistence, and rotation behavior on every request without changing your proxy configuration.

ModifierFormatExample
Country-country-xx, lowercaseyour-username-country-us
Region, optional-region- after the country and before the cityyour-username-country-us-region-ny
City, optional-city- after the country. After -region- when you set bothyour-username-country-us-city-newyork
Session (sticky IP)-ttl- then -session-your-username-ttl-3600-session-abc123
CombinedChain modifiers in that orderyour-username-country-de-ttl-3600-session-xyz
python
import uuid

# Different IP per request — default behavior
proxy_rotating = 'http://your-username:[email protected]:8080'

# Same IP for the ttl you set: 10, 30, 60 or 120 minutes
session_id = uuid.uuid4().hex[:12]
proxy_sticky = f'http://your-username-ttl-3600-session-{session_id}:[email protected]:8080'

# United States. City slugs come from the dashboard. New York is newyork.
proxy_geo = 'http://your-username-country-us-city-newyork:[email protected]:8080'

For a detailed comparison of when to use rotating vs sticky sessions, see rotating vs sticky proxies.

Security Considerations

Environment variables: Never hardcode credentials. Use environment variables or a secrets manager.

python
import os

PROXY_USER = os.environ['PROXY_USER']
PROXY_PASS = os.environ['PROXY_PASS']

proxy = {
    'http': f'http://{PROXY_USER}:{PROXY_PASS}@eu.proxylabs.app:8080',
    'https': f'http://{PROXY_USER}:{PROXY_PASS}@eu.proxylabs.app:8080',
}

Credential exposure in logs: Many HTTP libraries log the full URL, including credentials. Either sanitize your logs or use the Proxy-Authorization header directly:

python
import requests
import base64

proxy = {'http': 'http://eu.proxylabs.app:8080', 'https': 'http://eu.proxylabs.app:8080'}
auth = base64.b64encode(b'your-username:your-password').decode()

session = requests.Session()
session.proxies = proxy
session.headers['Proxy-Authorization'] = f'Basic {auth}'

# Logs won't show credentials in the proxy URL
r = session.get('https://httpbin.org/ip')

Browser-Based Auth

Selenium and Puppeteer handle proxy auth differently than HTTP libraries. See our specific guides:

API Token Authentication

Some proxy providers expose their proxy pool through a REST API instead of (or in addition to) a gateway server. You send an HTTP request to the API with your token, and it returns either a proxy list or the proxied response directly.

How It Works

Code example
Your Server
    │
    ├── GET https://api.provider.com/v1/proxy?url=target.com
    │   Header: Authorization: Bearer <api-token>
    │
    └── API returns proxied response (or proxy endpoint)

Typical Usage

python
import requests

API_TOKEN = 'your-api-token'

# Some providers proxy the request for you
response = requests.get(
    'https://api.provider.com/v1/scrape',
    headers={'Authorization': f'Bearer {API_TOKEN}'},
    params={
        'url': 'https://example.com/product/123',
        'country': 'US',
        'render_js': 'false',
    }
)

print(response.json())

When API Tokens Make Sense

  • Serverless environments: Lambda/Cloud Functions where you can't maintain persistent proxy connections.
  • Team management: Issue per-developer tokens, revoke individually without affecting others.
  • Usage tracking: API calls are inherently trackable — easy to see who's using what.

Downsides

  • No protocol flexibility: API tokens only work over HTTP. You can't use them with SOCKS5, browser automation tools, or non-HTTP protocols.
  • Extra hop: The provider's API receives the request before anything reaches the target. That is another stop on the path. Measure it on your own target if the added time matters.
  • Vendor lock-in: Your code calls a provider-specific API. Switching providers means rewriting integration code. With gateway proxies (username/password auth), switching is just changing a URL.

Which Should You Use?

If the provider offers IP whitelisting and the server IP never changes: that can be the simple option, and it has no country or session control. ProxyLabs residential plans use the username and password from the dashboard, including from a fixed server.

If you scrape from variable IPs (cloud, home, team): Username/password auth. It works everywhere and gives you per-request control through username modifiers.

If you use serverless functions: Username/password auth works in most cases. API tokens if your provider offers them and you want per-function usage tracking.

If you manage a team: API tokens for individual accountability. Username/password with shared credentials if you trust the team and want simplicity.

ProxyLabs residential plans use that username and password. us.proxylabs.app:8080 is the gateway for us, ca, mx, br, ar, co, cl, and pe. eu.proxylabs.app:8080 is the gateway for every other country, including the United Kingdom (gb), Japan, and Australia. The same credentials work in cURL, Python, Node.js, Selenium, Puppeteer, Playwright, and Scrapy. Country, region, city, and the sticky session are modifiers on the username. The password still works after your source IP changes.

Test your connection with the Proxy Tester to verify everything is working before running at scale.

Useful guide? Share it with your team.

Share
← Back to all articlesBack to top ↑
All articles ↗
residential proxies

How to Connect a ProxyLabs Residential Proxy

The residential gateways, username order, and sticky lengths ProxyLabs actually uses. Copy the finished string from your dashboard.

4 min read
cURL

How to Set Up a Proxy with cURL (Every Option Explained)

Complete cURL proxy reference: HTTP, HTTPS, SOCKS5, authentication, geo-targeting, and troubleshooting. Every flag and option with working examples.

8 min read
proxies

Rotating vs Sticky Proxies: When to Use Each

Sticky vs rotating proxies: a new address on each request, or the same address for 10, 30, 60, or 120 minutes. When to use each on ProxyLabs.

8 min read