> ## Documentation Index
> Fetch the complete documentation index at: https://docs.2extract.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication Methods

> Learn the two ways to authenticate your requests to the 2extract proxy gateway: Username & Password and IP Whitelisting.

To use our proxy network, every request you send to the proxy gateway must be authenticated. This ensures that only authorized users can access the service and that we can correctly attribute traffic usage to your account.

We offer two methods for authentication:

<CardGroup cols={2}>
  <Card title="Username & Password" icon="user-lock">
    The most common method. You include your proxy's unique credentials in every request.
  </Card>

  <Card title="IP Whitelisting (Coming Soon)" icon="shield-check">
    A more seamless method for servers. You pre-authorize your server's IP address, allowing it to connect without sending credentials.
  </Card>
</CardGroup>

***

## 1. Username & Password Authentication

This is the standard and most flexible authentication method. Each proxy you create in your dashboard has its own unique username and password.

### How it Works

You need to include these credentials in your proxy connection string in the following format:
`protocol://username:password@host:port`

### Example

Let's say your credentials are:

* **Username:** `2xt-customer-a1b2-proxy-steam`
* **Password:** `a_very_secure_password`
* **Host & Port:** `proxy.2extract.net:5555`

Your connection string for an HTTP client would look like this:

```
http://2xt-customer-a1b2-proxy-steam:a_very_secure_password@proxy.2extract.net:5555
```

<CodeGroup>
  ```bash cURL theme={null}
  # Using the credentials with cURL
  curl "https://api.ipify.org" \
    --proxy "http://2xt-customer-a1b2-proxy-steam:a_very_secure_password@proxy.2extract.net:5555"
  ```

  ```python Python (Requests) theme={null}
  # Using the credentials with Python's Requests library
  import requests

  proxies = {
      "http": "http://2xt-customer-a1b2-proxy-steam:a_very_secure_password@proxy.2extract.net:5555",
      "https": "http://2xt-customer-a1b2-proxy-steam:a_very_secure_password@proxy.2extract.net:5555",
  }

  response = requests.get("https://api.ipify.org", proxies=proxies)
  print(response.text)
  ```
</CodeGroup>

<Info>
  Remember, you can dynamically add parameters like `-country-de` to your username to control the proxy's behavior. Learn more in the [Geo-Targeting Parameters](/proxy-products/configuration/geo-targeting) guide.
</Info>

***

## 2. IP Whitelisting (Authorized IPs) (Coming Soon)

This method is ideal for servers or any machine with a static IP address. By whitelisting your IP, you can send requests without embedding credentials in your code.

### How it Works

1. **Add your IP:** In your proxy's settings page, go to the "Advanced Settings" section and add your server's IP address (e.g., `34.123.45.67`) to the **Authorized IPs** list.
2. **Connect without credentials:** Now, any request coming from that IP address to your proxy's `host:port` will be automatically authenticated.

### Example

Assuming your server's IP `34.123.45.67` has been whitelisted for the proxy at `proxy.2extract.net:5555`.

<CodeGroup>
  ```bash cURL theme={null}
  # No username or password needed!
  curl "https://api.ipify.org" \
    --proxy "http://proxy.2extract.net:5555"
  ```

  ```python Python (Requests) theme={null}
  # The proxies dictionary is now much simpler
  import requests

  proxies = {
      "http": "http://proxy.2extract.net:5555",
      "https": "http://proxy.2extract.net:5555",
  }

  response = requests.get("https://api.ipify.org", proxies=proxies)
  print(response.text)
  ```
</CodeGroup>

<Warning>
  **Important:** IP Whitelisting only works for **IPv4** addresses. If your server has a dynamic IP, you must use the Username & Password method.
</Warning>

### Which Method Should I Use?

| Scenario                                               | Recommended Method      |
| :----------------------------------------------------- | :---------------------- |
| Running scripts from your local machine (dynamic IP)   | **Username & Password** |
| Running scripts on a cloud server (static IP)          | **IP Whitelisting**     |
| Using a tool that doesn't support proxy authentication | **IP Whitelisting**     |
| Needing maximum flexibility and control                | **Username & Password** |
