Options
Create AuthConfig explicitly, then pass it to both the store and auth builder.
use better_auth::AuthConfig;
fn auth_config(secret: &str) -> AuthConfig { AuthConfig::new(secret) .app_name("My application") .base_url("https://auth.example.com") .base_path("/api/auth") .trusted_origin("https://app.example.com")}| Configuration | Purpose | Guide |
|---|---|---|
secret, managed_secrets |
Signing and encryption | Secrets |
base_url, base_path |
Public URL and auth mount | Installation |
trusted_origins |
Allowed request and redirect origins | Cookies |
session |
Expiry, refresh, cookies, storage | Sessions |
user, account, session.additional_fields |
Application data policies | Additional fields |
verification |
Verification credential storage | Secondary storage |
advanced.ip_address |
Trusted proxies and client identity | Rate limits |
background_tasks |
Observe background delivery | Notifications |
Plugin options are configured on each plugin instance. Middleware options such as rate limiting are registered on AuthBuilder.
For every field and default, use the AuthConfig source.
Related upstream topic: Options.