Selenium SOCKS5 Proxy With Login: Why Chrome Fails and a Fix
Why a SOCKS5 login never reaches the proxy from Chrome, and how to run Selenium through a small local forwarder that adds it.
Why Chrome cannot log in to SOCKS5
SOCKS5 has a handshake in which the client lists the login methods it can do and the proxy picks one. Chromium's client lists exactly one, "no authentication", and treats any other choice by the proxy as an error. A proxy that requires a username and password therefore refuses the connection before any page loads, and the credentials you put in the URL are never sent.
This is a browser limit, not a mistake in your Selenium code or your password. Tools that do implement the login method, such as curl, work with the same credentials, which is also the fastest way to tell the two cases apart. The wider picture for Chrome and Edge is in the guide linked here.
Test the login outside the browser with the first curl command below. It should print JSON with the proxy's exit IP.
Expected result JSON with the exit IP of the proxy.
Step 2
Install a forwarder that can chain to a SOCKS5 proxy with a login. The example uses gost; install it from its documentation at gost.run.
Step 3
Start it on 127.0.0.1 with a free local port, as in the gost command. Test it with the second curl command: no login is needed now.
Expected result The same exit IP as in step 1.
Step 4
Start Chrome through Selenium with --proxy-server=socks5://127.0.0.1:PORT, as in the Python example.
Step 5
Open https://ipinfo.io/json in that browser and compare the IP and country with step 1. Stop the forwarder when the test ends.
Test the login and the forwarder with curl
# 1) The login itself, outside the browser (socks5h = the proxy resolves the host name)
curl -x socks5h://LOGIN:PASSWORD@HOST:PORT https://ipinfo.io/json
# 2) The local forwarder, with no login
curl -x socks5h://127.0.0.1:1080 https://ipinfo.io/json
Example only: replace HOST, PORT, LOGIN and PASSWORD with the values from My assets.
Start the forwarder (gost example)
# Listen on 127.0.0.1 without a login, forward to the Proxy302 SOCKS5 endpoint with the login
gost -L socks5://127.0.0.1:1080 -F socks5://LOGIN:PASSWORD@HOST:PORT
Example only. Listening on 127.0.0.1 keeps the login usable from this computer only; do not listen on 0.0.0.0.
Selenium (Python) through the forwarder
# pip install -U selenium and install gost (see gost.run)
import socket, subprocess, time
from selenium import webdriver
from selenium.webdriver.common.by import By
LOCAL_PORT = 1080
forwarder = subprocess.Popen([
"gost",
"-L", f"socks5://127.0.0.1:{LOCAL_PORT}", # what Chrome connects to, no login
"-F", "socks5://LOGIN:PASSWORD@HOST:PORT", # what the forwarder connects to, with login
])
for _ in range(50): # wait until the local port is open
try:
socket.create_connection(("127.0.0.1", LOCAL_PORT), timeout=0.2).close()
break
except OSError:
time.sleep(0.2)
options = webdriver.ChromeOptions()
options.add_argument(f"--proxy-server=socks5://127.0.0.1:{LOCAL_PORT}")
driver = webdriver.Chrome(options=options)
try:
driver.get("https://ipinfo.io/json")
print(driver.find_element(By.TAG_NAME, "body").text) # the proxy's exit IP
finally:
driver.quit()
forwarder.terminate()
Example only: replace HOST, PORT, LOGIN and PASSWORD with the values from My assets.
Keep the forwarder private, and watch DNS
Bind the forwarder to 127.0.0.1, never to all interfaces: anyone who can reach an open forwarder port can use your login. Stop the process when the test ends, and keep the login out of shared scripts and logs.
With a socks5:// address Chrome lets the proxy resolve the host names of web pages, but Chromium's documentation warns that other parts of Chrome may still resolve names themselves. If the DNS path matters for your test, add the --host-resolver-rules flag described in that documentation.
Check The forwarder is not running, the local port differs from the one in --proxy-server, or something else holds the port.
Fix Run the second curl command. If it fails, fix the forwarder first; if it works, check the port in the Selenium options.
Stop when If the first curl command also fails, stop: the problem is the host, port or login, not the forwarder. See the connection failed guide.
The forwarder starts but every request fails
Check HOST, PORT or the login in the -F address is wrong, or the asset is HTTP only.
Fix Compare with My assets. A SOCKS5 endpoint is on port 3333 and an HTTP endpoint on port 2222 of proxy.proxy302.com; use the endpoint of the protocol the asset was issued with.
Pages load but ipinfo.io shows your own IP
Check Chrome did not take the flag, for example because an old Chrome process was already running with the same profile.
Fix Close all Chrome processes, use a fresh --user-data-dir, and check the flag is in the options passed to webdriver.Chrome.
Works once, then hangs in a loop of runs
Check The previous forwarder process is still holding the port.
Fix Call terminate() in a finally block as in the example, or pick a different local port per run.
How to do it with Proxy302
For a login that stays on one address, use a static ISP IP bought with the SOCKS5 protocol: it does not rotate during the lease and costs US$0.50 for 1 day or US$7.99 for 30 days (about US$0.27 a day). SOCKS5 runs on port 3333 of proxy.proxy302.com. There is no free trial; the smallest purchase is one IP for one day.
The forwarder works the same for every Proxy302 product. Pick the protocol on the purchase page, because each asset is issued with one protocol.
Open the static ISP page, choose the country and SOCKS5 as the protocol, review the cost and pay from the wallet.
Step 2
Open My assets and copy host, port, username and password.
Step 3
Put them into the -F address of the forwarder command: socks5://LOGIN:PASSWORD@HOST:PORT.
Step 4
Run the Selenium example and confirm the exit with https://ipinfo.io/json.
Selenium SOCKS5 FAQ
Does Selenium support SOCKS5 with a username and password?
Not in Chrome. Chromium's SOCKS5 client offers only the "no authentication" method, so the login never reaches the proxy. Use the HTTP endpoint or a local forwarder.
Why does socks5://user:pass@host:port in --proxy-server fail?
Chrome does not send the login in the SOCKS5 handshake, so a proxy that requires one refuses the connection. The URL form does not add a login method to the browser.
Do I need to change the Selenium code for the forwarder?
Only the proxy address: use --proxy-server=socks5://127.0.0.1:PORT instead of the remote address. The rest of the test stays the same.
Can I use the forwarder with several browsers at once?
Yes. Start one forwarder per proxy on different local ports, or point several browsers at one forwarder if they should leave from the same exit.
Is the HTTP endpoint simpler than the forwarder?
It needs no extra process, but Chrome then has to answer the proxy login, which Selenium does not do on its own. The Selenium setup page shows that route.
Selenium proxy with username and password in Chrome: HTTP proxy in ChromeOptions plus Selenium's BiDi auth handler, no extensions. Static datacenter IPs for test runs.
SOCKS5 on all three lines: rotating residential from US$1.50/GB, static ISP and datacenter IPs per IP and term. Port 3333 with username and password, and the errors you see when a setting is wrong.
Read on 13 November 2026: the greeting Chromium sends is 05 01 00 (one method, "no authentication"); a reply that selects a different method is handled as an unexpected-auth error and the connection fails.
Read on 13 November 2026: --proxy-server="socks5://myproxy:8080"; with it the host name of http and https URLs is resolved by the proxy server, not locally; other components of Chrome may issue DNS requests directly; --host-resolver-rules can block local resolution.
Read on 13 November 2026: every -F parameter on the command line adds one hop to the forwarding chain, e.g. gost -L http://:8080 -F https://192.168.1.1:8080; -L opens a local listener, see also the SOCKS page for gost -L socks5://user:pass@:1080.
The page has no example with a login inside -F. The login-in-URL form shown here is the same user:pass@host form used for -L; confirm it with gost --help or the docs of the version you install.
Proxy302 product facts and price list
Product observation · Confirmed on:
Product facts file, checked on 13 November 2026 against the console, backend and price list: static ISP lease prices per IP (US$, 1 PTC = US$1), rotating residential Budget line price per GB, HTTP port 2222 and SOCKS5 port 3333 on proxy.proxy302.com, which protocols work for which product, no free trial.
Ready to try it?
Create an account, top up once, then pick rotating residential, static ISP or datacenter IPs and have one running in your browser within minutes.