Skip to content

Authentication and CORS

Sign-in needs a verified address. If email is not configured, the link is logged: run wrangler tail, request a new link, and open the URL from the log.

Terminal window
pnpm run update -- --auth

Existing sessions can depend on the current authentication origin, so change it deliberately.

Add your website’s origin to CORS_ORIGINS on the API (comma-separated, exact scheme and host):

CORS_ORIGINS=https://www.example.com,http://localhost:4321

The Astro installer does not edit this for you. Setup adds the Admin Worker origin automatically.

On a cross-site setup the session cookie is third-party, and some browsers block those. Use the same-origin proxy.

Auth routes allow 10 POSTs per 60 seconds per IP, forms 5. Behind a proxy, configure TRUSTED_PROXY_SECRET so the limit is per visitor rather than per proxy.