Author
Blog by Infrastructure Team
All blog posts written by Infrastructure Team.

Custom Domain Configuration

Set up custom domains to provide branded authentication experiences.

DNS Configuration

Add the following records to your DNS:

Type    Host            Value
CNAME   auth           verify.authcompany.com
TXT     _verify.auth    verification-token-123

SSL Certificate Setup

domain:
  name: auth.yourcompany.com
  ssl:
    autoProvision: true
    provider: letsencrypt

Verification Process

const domainSetup = await auth.domains.create({
  domain: 'auth.yourcompany.com',
  verifyOwnership: true
});

console.log(domainSetup.verificationToken);

Nginx Configuration

server {
    server_name auth.yourcompany.com;
    
    ssl_certificate /etc/ssl/certs/auth.yourcompany.com.crt;
    ssl_certificate_key /etc/ssl/private/auth.yourcompany.com.key;
    
    location / {
        proxy_pass http://auth-backend;
        proxy_set_header Host $host;
    }
}

For wildcard certificates and advanced setups, see our enterprise guide.