***

title: get_basic_auth
slug: /reference/python/agents/configuration/security-config/get-basic-auth
description: Get basic authentication credentials, generating a password if not set.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

Get basic authentication credentials. If no password has been configured, a
random URL-safe password is generated (32 bytes of entropy, \~43 characters) and
stored on the instance.

## **Returns**

`tuple[str, str]` -- A tuple of `(username, password)`. The username defaults
to `"signalwire"` if not explicitly set.

<Warning>
  Auto-generated passwords change on every instantiation. In production, always set
  `SWML_BASIC_AUTH_PASSWORD` explicitly so webhook credentials remain stable across
  restarts.
</Warning>

## **Example**

```python {4}
from signalwire.core.security_config import SecurityConfig

security = SecurityConfig()
username, password = security.get_basic_auth()

print(f"Auth: {username}:{password}")
```