Environment Variables

Required

VariablePurpose
JWT_PRIVATE_KEYSigns session JWTs
JWKSJSON Web Key Set for verification
AUTH_SECRET_ENCRYPTION_KEYEncrypts stored group SSO secrets
SITE_URLFrontend URL for OAuth/magic link redirects

These are set automatically by the CLI setup wizard.

System (auto-provided by Convex)

VariablePurpose
CONVEX_SITE_URLHTTP actions URL. Used as JWT issuer and OAuth callback base.

Your convex/auth.config.ts should trust this same value as the native Convex JWT issuer:

export default {
  providers: [
    {
      domain: `${process.env.CONVEX_SITE_URL}/auth`,
      applicationID: "convex",
    },
  ],
};

Provider

PatternExample
AUTH_<PROVIDER>_IDAUTH_GITHUB_ID
AUTH_<PROVIDER>_SECRETAUTH_GITHUB_SECRET

OAuth provider env

ProviderRequired variablesOptional variables
GoogleAUTH_GOOGLE_ID, AUTH_GOOGLE_SECRET-
GitHubAUTH_GITHUB_ID, AUTH_GITHUB_SECRET-
AppleAUTH_APPLE_ID, AUTH_APPLE_TEAM_ID, AUTH_APPLE_KEY_ID, AUTH_APPLE_PRIVATE_KEY-
MicrosoftAUTH_MICROSOFT_TENANT_ID, AUTH_MICROSOFT_IDAUTH_MICROSOFT_SECRET

OAuth provider callbacks default to:

${CONVEX_SITE_URL}/auth/callback/<provider>

This uses CONVEX_AUTH_HTTP_PREFIX, which defaults to /auth, matching the default auth.http() route prefix. Pass redirectUri in provider config when you want to override that default.

Optional

VariablePurposeDefault
SECONDARY_URLComma-separated extra frontend origins for passkeys and shared auth flows-
AUTH_SESSION_TOTAL_DURATION_MSMax session lifetime30 days
AUTH_SESSION_INACTIVE_DURATION_MSInactive session timeoutProvider-specific
AUTH_LOG_LEVELDEBUG / INFO / WARN / ERRORINFO

.well-known content

These drive the .well-known endpoints — leave them unset to disable a given endpoint (it then returns 404).

VariablePurposeDefault
IOS_APP_IDSComma-separated TEAMID.bundle.id for apple-app-site-association-
IOS_APPLINK_PATHSComma-separated path patterns for applinks (e.g., /auth/*)/auth/*,/callback/*
ANDROID_APP_LINKSpackage:FP1;package2:FP2 for assetlinks.json-
WEBAUTHN_ALT_ORIGINSComma-separated origins for /.well-known/webauthnfalls back to SECONDARY_URL
CHANGE_PASSWORD_URLRedirect target for /.well-known/change-password-
SECURITY_CONTACTContact: for security.txt (mailto: or https:)-
SECURITY_TXT_EXPIRES_DAYSDays until Expires: in security.txt365

SITE_URL remains the canonical frontend URL used for generated links and default redirects. Use SECONDARY_URL to allow additional localhost or hosted frontend origins to share the same auth instance:

SITE_URL=https://app.example.com
SECONDARY_URL=http://localhost:3000,http://localhost:5173,https://staging.example.com