# Getting SSL Error when login

**URL:** <https://discuss.huggingface.co/t/getting-ssl-error-when-login/9357>\
**Category:** Beginners\
**Created:** [August 19, 2021, 11:00pm UTC](https://discuss.huggingface.co/t/getting-ssl-error-when-login/9357 "2021-08-19T23:00:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anahita](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@anahita](https://discuss.huggingface.co/u/anahita)\
**Post date:** [August 19, 2021, 11:00pm UTC](https://discuss.huggingface.co/t/getting-ssl-error-when-login/9357/1 "2021-08-19T23:00:37Z")

</div>

I am a new user and geting the foillowinig error when I enter my password using this command: huggingface-cli login. Please help.

requests.exceptions.SSLError: HTTPSConnectionPool(host=‘[huggingface.co](http://huggingface.co)’, port=443): Max retries exceeded with url: /api/login (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE\_VERIFY\_FAILED] certificate verify failed: self signed certificate in certificate chain (\_ssl.c:1131)’)))

---

<div class="post-metadata">

**Author:** ![soumensardar-sdwie](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@soumensardar-sdwie](https://discuss.huggingface.co/u/soumensardar-sdwie)\
**Post date:** [November 26, 2025, 7:26am UTC](https://discuss.huggingface.co/t/getting-ssl-error-when-login/9357/2 "2025-11-26T07:26:46Z")

</div>

**Root cause:** it requires a SSL verification certificate while accessing the huggingface and this is happening probably because of your VPN provider.

**Solution:** Provide your VPN SSL verification certificate or by-pass it entirely (not recommended)

The Python hugging-face API does not have straight-forward approach, but we can do it by updating the HTTP backend.

```python
def backend_factory():
    print("backend factory is called")
    session = requests.Session()
    # (not recommended)
    session.verify = False # by-pass
    # recommended approach
    # Note: you can download the '*.crt' file from browser
    # session.verify = r"/path/to/your_vpn.crt") 
    return session

# this call will configure entire hggingface with a new session
# with SSL configured
configure_http_backend(backend_factory)

print("Login...")
login(token=hf_access_token)

```

Now your code must run with an warning as below:

```bash
InsecureRequestWarning: Unverified HTTPS request is being made to host 'huggingface.co'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings
  warnings.warn(

```

Subsequent calls to the HuggingFace will work peacefully:

```python
feature_extractor = pipeline(
        model=model,
        task="image-feature-extraction",
)
features = feature_extractor(image)

```

Thanks
