Going to production
Your development instance is ready at once; the production instance needs a few things only you can provide. Work through the list in order. Every step links to the page that explains it.
1. Custom domain
Section titled “1. Custom domain”A production instance serves sign-in from a subdomain of your own site, such as accounts.example.com. In the
dashboard choose Go to production, enter the host and add the CNAME record it shows. The instance works once the
domain is active. Several later steps (the social redirect URL, the live keys’ host) depend on it. See
Custom domains.
2. Live keys
Section titled “2. Live keys”Replace the development keys with the production instance’s: pk_live_… in your frontend and sk_live_… on your
server, both under API keys of the production instance. The secret key is shown once. Development keys
(pk_test_…, sk_test_…) belong to the development instance and never see your production users. See
Instances and environments.
| SDK | Where |
|---|---|
| Next.js | NEXT_PUBLIC_ZAUTHA_PUBLISHABLE_KEY and ZAUTHA_SECRET_KEY |
| Node.js | publishableKey option and ZAUTHA_SECRET_KEY |
| ASP.NET Core | Zautha:PublishableKey and Zautha:SecretKey (Zautha__PublishableKey, Zautha__SecretKey) |
In Next.js, NEXT_PUBLIC_ZAUTHA_PUBLISHABLE_KEY must be set when you run next build, not only when the server starts:
the build reads it to prerender. A Docker image built without it fails to build, and one built with the development key
shows that key in production. If you build once and deploy the same image with different keys, use
<ZauthaProvider dynamic>: it reads the key per request, so the build needs none.
3. Authorized parties
Section titled “3. Authorized parties”Your server accepts a session token only when it was issued for one of your own origins (the token’s azp). List
every origin your app is served from, exactly (https://app.example.com, no path or trailing slash):
- Next.js: the
ZAUTHA_AUTHORIZED_PARTIESenvironment variable, comma-separated. Leave it unset while developing onlocalhost. See@zautha/nextjs. - Node.js and Express: the
authorizedPartiesoption ofzauthaMiddleware,authenticateRequestandverifyToken. See@zautha/backend. - ASP.NET Core:
options.AuthorizedParties. SeeZautha.AspNetCore.
On an origin missing from the list every request is signed out.
4. Allowed origins
Section titled “4. Allowed origins”Every https origin on your domain and its subdomains is already an allowed origin of the production instance. List
any other origin your pages are served from in Auth settings; a production instance accepts https origins only.
5. Social credentials
Section titled “5. Social credentials”A production instance uses your own OAuth app at each social provider; Zautha’s shared apps are for development only. For each provider you offer, create the app, register the instance’s redirect URL and enter the credentials in Social connections: Social providers, with a page each for Google, GitHub, Microsoft, Discord, GitLab and Apple. Zautha refuses to enable a provider on a production instance until its own credentials are complete.
6. Bot protection
Section titled “6. Bot protection”Production sign-up, and sign-in after repeated failures, need a Cloudflare Turnstile check that the SDK runs in a frame
from https://accounts.zautha.com. If your pages send a Content Security Policy, allow it:
Content-Security-Policy: frame-src https://accounts.zautha.com(add it to the frame-src you already have). Without it the check cannot load and the call fails with a
ZauthaCaptchaError, usually with code timeout (see @zautha/js). Sites that only send users to the instance’s
hosted login have no sign-in on their own pages and need nothing. See
Bot protection.
7. Webhooks
Section titled “7. Webhooks”Webhook endpoints are per instance, so add the production endpoint again on the production instance’s Webhooks
page, with an https URL on a public host, and give your server that endpoint’s signing secret (whsec_…). A
development endpoint never receives production events. See Webhooks.
8. Optional: sign-up restrictions
Section titled “8. Optional: sign-up restrictions”Allowlist and blocklist are per instance too, off by default. If you restrict who can sign up, set the lists on the production instance. See Sign-up restrictions.
What does not carry over
Section titled “What does not carry over”- Test identities: addresses ending in
+zautha_testand the code424242work on development instances only. On production they are ordinary addresses that receive real mail. - Users, settings, OAuth clients and signing keys: an instance shares nothing with the other one, so settings you made in development (sign-in options, branding, organizations) are made again in production.