/v1/apps/{app_id}/auth-configAuthUpdate the per-app auth config. Only fields you pass are changed.
Path parameters
app_id*stringId of the app.
Request body
signup_enabledbooleanWhether new EndUsers can sign up.
signup_requires_pakbooleanWhen true, sign-up only works from your backend: every `POST /{app_slug}/v1/auth/signup` must carry a Platform API Key (`Authorization: Bearer pcft_live_…`) from this app's workspace whose policy allows `auth.signup.create` on this app. Anonymous sign-ups get 401. Use it when your own backend gates sign-ups (CAPTCHA, invite or payment checks). Independent of `bot_protection`; an app can use both. Turning it on for an app that has no workspace is refused with 409.
signin_enabledbooleanWhether existing EndUsers can sign in.
signup_allowed_email_domainsarrayOptional allowlist of email domains for signup. Empty array = any domain.
Example: ["acme.com","acme.io"]
signup_default_rolestringRole slug newly-signed-up EndUsers receive (e.g. `member`).
Example: "member"
session_duration_minutesnumberSession lifetime in minutes (1 minute to 30 days).
Example: 10080
access_token_minutesnumberEndUser access-token lifetime in minutes (5-60, default 60). Independent of `session_duration_minutes`: the session and its refresh token can live for days while the access token expires in minutes. An access token is never issued for longer than the session it belongs to has left. M2M (client-credentials) tokens are unaffected and keep their fixed one-hour lifetime.
Example: 60
max_failed_login_attemptsnumberConsecutive failed signin attempts before an EndUser is locked out for 15 minutes. Applies to the signin lockout counters only; the separate short-burst limiter (5 attempts per identifier per minute) is fixed and not configurable.
Example: 5
password_min_lengthnumberMinimum password length (NIST minimum is 8).
Example: 12
password_require_uppercasebooleanRequire an uppercase letter in passwords.
password_require_numberbooleanRequire a digit in passwords.
password_require_symbolbooleanRequire a symbol in passwords.
max_sessionsnumberMaximum concurrent sessions per EndUser. When a signin would take the account past this number, the OLDEST session — the one created longest ago, not the one used longest ago — is revoked (audited as `auth.session.evicted`). Omit or send null for unlimited.
Example: 5
enforce_app_permissionsbooleanWhen true, Consumer-API routes annotated with `@RequireAppPermission(perm)` enforce the requested perm against the EndUser's role-resolved permission set. When false (default), permission checks are bypassed — any valid token can call any annotated route. Flip on once you've authored roles + permissions for this app and want them to actually mean something.
oauth_link_policyenum (3)How to handle a federated sign-in (Apple, Google, …) that lands on a verified email already belonging to an account in this app. `confirm` (default) refuses to auto-link and surfaces `link_required` so the user signs in with their original method. `auto` silently links when the provider claims the email is verified AND the email is not a private relay. `reject` refuses outright. Private-relay emails never auto-link regardless.
allowed_redirect_originsarrayAllowed origins for the `return_to` parameter on the OAuth web redirect callback. Exact origin match (scheme + host + port); no paths, no wildcards. Empty array disables the web redirect flow for this app. Prevents the callback from acting as an open-redirect.
Example: ["https://app.example.com"]
password_breach_checkenum (3)Whether passwords are checked against a public breach corpus (HIBP Pwned Passwords, k-anonymity range API) before being accepted. `block` (default) rejects a breached password with 400 `PASSWORD_BREACHED`. `warn` accepts it and returns `password_warnings: ["breached"]` alongside the tokens. `off` disables the lookup entirely, so no outbound call is made. The lookup always fails open — a timeout or an unreachable corpus never blocks a signup. Only the first five characters of the password's SHA-1 ever leave the service.
mfaenum (2)Whether every EndUser must hold an MFA factor. `optional` (default) leaves MFA per-user opt-in. `required` refuses to mint a session for a user with no enabled factor: sign-in answers `{ mfa_enrollment_required: true, mfa_token, expires_at }` and the user enrols via POST /{app_slug}/v1/auth/mfa/enroll. IMPORTANT: turning this on does NOT terminate sessions that are already live — existing users keep their session until it expires or is revoked and only meet the requirement on their next sign-in. Revoke sessions explicitly if the policy has to bite immediately.
mfa_grace_daysnumberGrace window in days, measured from ACCOUNT CREATION, during which `mfa: required` still mints ordinary tokens. The sign-in response then also carries `mfa_enrollment_due_at` so a client can prompt rather than block. 0 (default) means no grace. Note the anchor: an app that turns the policy on with existing users will find every account older than the window is already past it.
Example: 0
unverified_account_ttl_daysnumberDelete accounts whose primary email is still unverified this many days after sign-up. Only self-sign-ups that never signed in after sign-up, hold no two-step factor, no verified contact and no social login qualify. Deletion is permanent, frees the email address and username, is audited as `auth.account.expired_unverified` and fires `user.deleted` with `reason: "unverified_expired"`. Send null to never delete. New apps start at 7; apps created before this setting existed start at null.
Example: 7
bot_protectionobjectSign-up bot protection (Cloudflare Turnstile or hCaptcha). Fields you send are merged onto the stored block; send null to remove the block and its secret. While `enabled`, sign-up requires a `bot_protection_token` the provider accepts, checked before anything else, and fails closed (503) when the provider cannot be reached.
passwordless_emailobjectEmail sign-in by magic link and/or 6-digit code, as a primary method (sign-in and sign-up in one flow). Fields you send are merged onto the stored block; send null to remove it. Needs Auth emails on with a sign-in template (`sign_in_template_name`).
test_modeobjectTest mode for CI and agents: `+pc_test` addresses sign in with a fixed code and never get email. Fields you send are merged; null removes it. Every switch is audited (`app.auth_config.test_mode_changed`) and every use too (`auth.test_identity.used`).
Response · 200
signup_enabled*booleanWhether new users can sign up.
signup_requires_pak*booleanWhen true, sign-up requires a Platform API Key from this app's workspace (anonymous sign-ups get 401).
signin_enabled*booleanWhether existing users can sign in.
signup_allowed_email_domains*arrayEmail domains allowed to sign up; empty means any domain.
signup_default_role*stringRole newly signed-up users receive.
Example: "member"
session_duration_minutes*numberSession lifetime in minutes.
Example: 10080
access_token_minutes*numberAccess-token lifetime in minutes (5-60).
Example: 60
max_failed_login_attempts*numberConsecutive failed sign-ins before an account is locked for 15 minutes.
Example: 5
password_min_length*numberMinimum password length.
Example: 12
password_require_uppercase*booleanWhether passwords need an uppercase letter.
password_require_number*booleanWhether passwords need a digit.
password_require_symbol*booleanWhether passwords need a symbol.
max_sessions*numberMaximum concurrent sessions per user; a sign-in past it ends the oldest session.
Example: null
enforce_app_permissions*booleanWhether routes that declare an app permission enforce it against the user's role.
oauth_link_policy*objectWhat a federated sign-in does when its verified email already belongs to an account in the app: `auto` links it, `confirm` asks the user to prove the existing account first, `reject` refuses the sign-in.
allowed_redirect_origins*arrayOrigins the OAuth web flow may redirect back to (`return_to`), exact match.
password_breach_check*objectBreached-password check on sign-up and password changes: `block`, `warn` or `off`.
Example: "block"
mfa*objectWhether every user must hold an MFA factor: `optional` or `required`.
Example: "optional"
mfa_grace_days*numberDays after account creation during which `mfa: required` still mints ordinary tokens.
Example: 0
unverified_account_ttl_days*numberDays an account may keep an unverified primary email before it is deleted. null = never.
Example: 7
bot_protection*objectSign-up bot protection; null when not configured.
passwordless_email*objectEmail sign-in (magic link / code); null when never configured.
test_mode*objectTest mode; null when never configured.
Example
Request
PATCH https://api.auth.productcraft.co/v1/apps/{app_id}/auth-config
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"signup_enabled": false,
"signup_requires_pak": false,
"signin_enabled": false,
"signup_allowed_email_domains": [
"acme.com",
"acme.io"
],
"signup_default_role": "member",
"session_duration_minutes": 10080,
"access_token_minutes": 60,
"max_failed_login_attempts": 5,
"password_min_length": 12,
"password_require_uppercase": false,
"password_require_number": false,
"password_require_symbol": false,
"max_sessions": 5,
"enforce_app_permissions": false,
"oauth_link_policy": "auto",
"allowed_redirect_origins": [
"https://app.example.com"
],
"password_breach_check": "off",
"mfa": "optional",
"mfa_grace_days": 0,
"unverified_account_ttl_days": 7,
"bot_protection": {},
"passwordless_email": {},
"test_mode": {}
}import { Auth } from "@productcraft/auth";
// Admin routes read PRODUCTCRAFT_API_KEY; consumer routes need no key
const auth = new Auth();
const authConfig = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").authConfig.update({ access_token_minutes: 60 });auth.admin.app(…).authConfig.update(params?, options?): Auth.AuthConfig
Response
{
"signup_enabled": false,
"signup_requires_pak": false,
"signin_enabled": false,
"signup_allowed_email_domains": [
"string"
],
"signup_default_role": "member",
"session_duration_minutes": 10080,
"access_token_minutes": 60,
"max_failed_login_attempts": 5,
"password_min_length": 12,
"password_require_uppercase": false,
"password_require_number": false,
"password_require_symbol": false,
"max_sessions": null,
"enforce_app_permissions": false,
"oauth_link_policy": {},
"allowed_redirect_origins": [
"string"
],
"password_breach_check": "block",
"mfa": "optional",
"mfa_grace_days": 0,
"unverified_account_ttl_days": 7,
"bot_protection": {},
"passwordless_email": {},
"test_mode": {}
}