get_basic_auth

View as MarkdownOpen in Claude

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.

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

Example

1from signalwire.core.security_config import SecurityConfig
2
3security = SecurityConfig()
4username, password = security.get_basic_auth()
5
6print(f"Auth: {username}:{password}")