You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clerk sign-in as decided, the hosted pages, and the test story #115
The facts the build needs for the decided sign-in — Google, Microsoft, an emailed code, no passwords — with no frontend of Patchy's own:
Configuring each strategy: Google and Microsoft OAuth in a development instance (shared credentials) and in production (own OAuth app, consent screen, verified domain); email code (OTP) as a strategy; turning passwords off; what the sign-up form then asks for.
The Account Portal: hosted sign-in and sign-up URLs in development (*.accounts.dev) and production (accounts.<domain>), redirect_url and the allowed redirect origins, what happens after sign-in and after sign-up, the hosted user-profile page, sign-out.
Session settings: inactivity timeout, maximum lifetime, multi-session, and what the defaults are.
The Backend API for one user by id: email, name, image; rate limits.
Testing without a browser: @clerk/testing, testing tokens, +clerk_test emails with the fixed code, and — the key question for the vitest suite — whether a session JWT signed with Patchy's own test keypair and verified through jwtKey is a supported way to exercise server-side auth. What Clerk recommends for server-side tests.
Development-instance limits: user cap, the development-mode banner, the dev-browser cookie, and what a production instance needs (domain, DNS, keys).
Output: the resolution comment on this ticket, each claim cited. Feeds The dev loop and tests with Clerk, the door ticket, and the task that creates the Clerk application.
Read on 2026-09-02 from clerk.com/docs (the docs moved under /docs/guides/...; old paths redirect), clerk/javascript main (@clerk/backend 3.17.0, @clerk/testing 2.2.32), clerk/openapi-specs (bapi/2026-05-12.yml, the version @clerk/backend 3.17.0 pins as SUPPORTED_BAPI_VERSION; bapi/2025-03-12.yml says the same on every point below), Google Cloud and Microsoft Learn. "Unverified" marks anything I could not pin to a primary page.
1. Strategies: Google, Microsoft, email code, no passwords
Google. Dashboard: SSO connections -> Add connection -> For all users -> Google. Development instances use Clerk's "preconfigured shared OAuth credentials and redirect URIs — no other configuration is needed." Production: toggle "Enable for sign-up and sign-in" and "Use custom credentials", copy the Authorized Redirect URI Clerk shows, create an OAuth client ID (Web application) in Google Cloud -> APIs & Services -> Credentials, paste Client ID and Client Secret back. Google's OAuth consent screen must be set to "In production" before launch. Blocking of +, =, # email subaddresses is on by default. [https://clerk.com/docs/guides/configure/auth-strategies/social-connections/google]
Google's side: Testing status caps the app at 100 listed test users, shows them a warning, and their consent expires after 7 days; "In production" opens it to any Google account. Apps requesting only userinfo.email, userinfo.profile, openid show no warning and their authorizations do not expire. [https://support.google.com/cloud/answer/15549945] "If your app utilizes only non-sensitive scopes, it is not mandatory for your app to complete the app verification process"; the lighter "brand verification" is needed only to show an app name and logo on the consent screen. [https://support.google.com/cloud/answer/13463073] Clerk's Google page says the switch to "In production" "requires verification of your app name, logo, and requested scopes"; Google's own page above is the authority and contradicts that for basic scopes. Every domain in "Authorized domains" must be owned and verified in Google Search Console by a project owner/editor; the homepage must be on a verified domain and "can not be only a login page"; without brand verification only the app's domain shows on the consent screen, not name/logo. [https://support.google.com/cloud/answer/13464321], [https://support.google.com/cloud/answer/10311615]
Microsoft. Same dashboard path with Microsoft. Dev: shared credentials. Production: Entra ID -> App registrations -> New registration, supported account types "Accounts in any organizational directory ... and personal Microsoft accounts", platform Web, the Redirect URI from Clerk; copy Application (client) ID; Certificates & secrets -> New client secret (expiry mandatory, default 6 months, max 24 months); under Authentication enable "Access tokens" and "ID tokens"; paste into Clerk. Clerk supports only the common tenant and only secret credentials (no certificates). nOAuth mitigation: add optional claims email and xms_pdl to both ID and access tokens, set "acceptMappedClaims": true in the manifest, replace xms_pdl with xms_edov so Clerk can trust the email is verified. [https://clerk.com/docs/guides/configure/auth-strategies/social-connections/microsoft]
Microsoft's side: a multitenant app registered after 2020-11-30 shows "unverified" on the consent prompt unless it is publisher-verified; publisher domain is set under Branding by hosting https://<domain>/.well-known/microsoft-identity-association.json. Multitenant apps with a null publisher domain are restricted to one root domain across redirect URIs (localhost exempt). [https://learn.microsoft.com/en-us/entra/identity-platform/howto-configure-publisher-domain, page updated 2026-06-15]
Email code. Dashboard User & authentication: "Email verification code: Users receive an OTP to their email address to sign in." 30-second cooldown between code requests; code valid 10 minutes. "Email verification link" is the alternative (link valid 10 minutes, optional "Require the same device and browser"). [https://clerk.com/docs/guides/configure/auth-strategies/sign-up-sign-in-options]
Passwords off. Same page, Password toggle: "Disabling Password will only affect new users. Existing users will still be able to sign in with their existing password." Turn it off before the first real user. With only email code enabled, the sign-in form asks for the email, then the code. [same page]
Sign-up form. Identifiers Email address / Phone number / Username are each Required or Optional; first and last name are governed by "Allow users to set their first and last name" in the User model section (whether name can be required at sign-up: unverified). Username, if enabled, is 4–64 characters with no special characters (^$!.\#+~`). [same page] A Google/Microsoft sign-up creates the user from the provider profile (email, name, image) without a form; that inference follows from the connection docs but is not stated as such: unverified.
Dev-mode notice in Clerk's UI components. Since 2024-08 Clerk's UI components in development instances carry a "Development mode" notice; the changelog says it "currently applies only to newly created applications" at that date and can be hidden with layout unsafe_disableDevelopmentModeWarnings. Whether the hosted Account Portal pages show it: unverified. [https://clerk.com/changelog/2024-08-02-dev-notice]
2. Account Portal (hosted pages)
Pages: sign-in (<SignIn />), sign-up, user profile, unauthorized-sign-in (device revocation), create-organization, organization, waitlist. "After a user finishes a flow in Account Portal, Clerk redirects them to your application with the required authentication context." [https://clerk.com/docs/guides/account-portal/overview]
URLs, production: https://accounts.<domain>/sign-in, /sign-up, /user, /unauthorized-sign-in, /organization, /create-organization. Development: a randomly generated <slug>.accounts.dev host, same paths; the Frontend API in dev is https://<slug>.clerk.accounts.dev. Exact URLs are on the Dashboard's Account Portal -> Overview tab. In development "the development host (e.g., http://localhost:3000) is dynamically detected by Clerk at runtime and tied to your client browser" and stored as the "home origin", the equivalent of the app domain in production. [https://clerk.com/docs/guides/account-portal/getting-started], [https://clerk.com/docs/guides/how-clerk-works/overview]
Direct link: https://accounts.<domain>/<page>?redirect_url=<url>. "The redirect_url value must be a URL on your instance's domain or one of its subdomains, or share the same origin as the requesting page (which is why localhost works in development)." Without redirect_url, the Dashboard's Account Portal -> Redirects tab sets fallback URLs "for sign-in, sign-up, and other Account Portal flows" (exact field list: unverified). Prefill params: email_address, phone_number, username, first_name, last_name. [https://clerk.com/docs/guides/account-portal/direct-links]
Redirect precedence in Clerk's SDK terms: a "force" redirect URL wins over everything including redirect_url; otherwise redirect_url in the query wins over the fallback; fallbacks default to /. [https://clerk.com/docs/guides/development/customize-redirect-urls] clerk-js option allowedRedirectOrigins: (string | RegExp)[] is "an array of domains to validate user-provided redirect URLs against. If no match is made, the redirect is considered unsafe and the default redirect will be used with a warning logged in the console"; afterSignOutUrl, signInForceRedirectUrl, signInFallbackRedirectUrl (defaults to '/') exist as options. [https://clerk.com/docs/js-frontend/reference/objects/clerk]
Disable: Account Portal page -> "Disable Account Portal" (bottom); only allowed once another auth flow exists; all portal pages then 404. [https://clerk.com/docs/guides/account-portal/disable-account-portal]
How the session reaches a server that runs no clerk-js (from @clerk/backend source, not a doc page): authenticateRequest reads __session, __client_uat, __clerk_db_jwt, __clerk_handshake, __clerk_handshake_nonce and the Authorization header. With __client_uat but no or expired __session (ClientUATWithoutSessionToken, SessionTokenExpired-refresh-*), or in dev with __clerk_db_jwt in the query or no dev-browser token at all (DevBrowserSync/DevBrowserMissing), it returns status handshake with a Location to <FAPI>/v1/client/handshake?redirect_url=...&__clerk_api_version=2026-05-12&<suffixed-cookies flag>&__clerk_hs_reason=<reason>&format=nonce (plus __clerk_db_jwt in dev); on return it turns the handshake payload into Set-Cookie headers, in dev strips the handshake params and redirects again; loop guard cookie __clerk_redirect_count (SameSite=Lax; HttpOnly; Max-Age=2), stops at 3. With no cookies at all on a non-satellite production instance it returns signed-out (SessionTokenAndUATMissing). [https://raw.githubusercontent.com/clerk/javascript/main/packages/backend/src/tokens/request.ts], [https://raw.githubusercontent.com/clerk/javascript/main/packages/backend/src/tokens/handshake.ts], [https://raw.githubusercontent.com/clerk/javascript/main/packages/backend/src/constants.ts] The docs describe the same loop for server-rendered apps: server returns a redirect, browser follows to FAPI, FAPI "issues a new session token." [https://clerk.com/docs/guides/how-clerk-works/overview]
Sign-out: there is no hosted sign-out page in the Account Portal list. clerk.signOut({ sessionId?, redirectUrl? }) in clerk-js signs out all sessions (multi-session) or the current one; other devices stay signed in. [https://clerk.com/docs/guides/development/custom-flows/authentication/sign-out] Server side: revokeSession(sessionId) / POST /v1/sessions/{session_id}/revoke "Revokes the given session. The user will be signed out from the client the session is associated with." [https://clerk.com/docs/reference/backend/sessions/revoke-session] The user-profile page (/user) is the hosted <UserProfile />, which in Clerk's components carries the sign-out control (unverified that the hosted page exposes it).
3. Sessions
Dashboard Sessions page (dashboard.clerk.com/~/sessions). Inactivity timeout: disabled by default; "a user is considered inactive when the application is closed, or when the app stops refreshing the token"; "requires a paid plan for production use, but all features are free to use in development mode"; numeric bounds: unverified. Maximum lifetime: "enabled with a default value of 7 days for all newly created instances"; custom values need a paid plan in production. "Either one or both must be enabled at all times." Multi-session handling: a toggle on the same page ("Toggle on Multi-session handling"); the docs do not state its default, so "off by default" is unverified (the pricing page's Free plan excluding "Simultaneous sessions" implies it cannot be on for Free). Chrome signs users out within 400 days regardless of the setting. These settings "are Dashboard-only and can't be changed via the CLI or Backend API." [https://clerk.com/docs/guides/secure/session-options] Pricing confirms the gate: Free plan "Fixed, 7 day session lifetime" and no "Simultaneous sessions"; Pro ($25/mo, $20/mo billed annually) unlocks custom session duration, branding removal, allowlist/blocklist, simultaneous sessions; Free is 50,000 MRU with Clerk branding. [https://clerk.com/pricing]
Session JWT: lifetime 60 seconds, refreshed by clerk-js "on a 50-second interval (allowing 10 seconds for network latency)" via /client/sessions/<id>/tokens [https://clerk.com/docs/guides/how-clerk-works/overview]; default claims (v2) azp (the Origin header of the FAPI request), exp, fva, iat, iss (FAPI URL), jti, nbf, sid, sub, v, pla, fea, sts, o when an org is active. Keep custom claims under 1.2 KB (4 KB cookie limit). [https://clerk.com/docs/guides/sessions/session-tokens]
Cookies (docs + clerk-js source): __client HttpOnly JWT on the FAPI domain (clerk.<domain>), SameSite=Lax, browser-limited lifetime; __session on the app host, not HttpOnly, no Domain attribute ("scoped strictly so it cannot be shared across subdomains"), SameSite=Lax (None when partitioned or in a cross-origin iframe). Cookie expiry: the docs page says "Expiration: 60 seconds" while clerk-js sets expires = addYears(Date.now(), 1); the JWT inside expires in 60 s either way. __client_uat value = client updated_at seconds or 0, 1 year, domain from getCookieDomain(); clerk-js sets it SameSite=Strict in development, and the source comment says in production FAPI sets it with Lax. __clerk_db_jwt dev-only, passed as a query string because localhost and accounts.dev are cross-site; "Do not rely on __clerk_db_jwt in your application code, as it will break in production." [https://clerk.com/docs/guides/how-clerk-works/overview], [https://raw.githubusercontent.com/clerk/clerk-docs/main/docs/_partials/clerkdbjwt-vs-client-cookie.mdx], [https://raw.githubusercontent.com/clerk/javascript/main/packages/clerk-js/src/core/auth/cookies/session.ts], [https://raw.githubusercontent.com/clerk/javascript/main/packages/clerk-js/src/core/auth/cookies/clientUat.ts]
4. Backend API: one user by id
GET https://api.clerk.com/v1/users/{user_id} (operationId GetUser), Bearer secret key. User wire fields: id, external_id, username, first_name, last_name, profile_image_url (deprecated alias), image_url, has_image, email_addresses[], primary_email_address_id, external_accounts[], last_sign_in_at, created_at, updated_at, banned, locked. [https://raw.githubusercontent.com/clerk/openapi-specs/refs/heads/main/bapi/2026-05-12.yml] SDK: clerkClient.users.getUser(userId: string): Promise<User> with firstName: null | string, lastName: null | string, fullName (accessor), imageUrl: string, hasImage: boolean, primaryEmailAddressId: null | string, emailAddresses: EmailAddress[], externalAccounts: ExternalAccount[]. [https://clerk.com/docs/reference/backend/user/get-user], [https://clerk.com/docs/reference/backend/types/backend-user]
Rate limits, per instance: production 1,000 requests / 10 s, development 100 / 10 s; JWKS unlimited; user metadata updates 10 / 10 s per user; 429 with Retry-After giving "the number of seconds after which the block expires". Frontend API per user/IP: sign-in/sign-up creation 5 / 10 s, attempts 3 / 10 s. [https://clerk.com/docs/guides/how-clerk-works/system-limits]
5. Testing without a browser
@clerk/testing 2.2.32 exports only ./playwright, ./playwright/unstable, ./cypress (optional peer deps @playwright/test ^1, cypress ^13||^14||^15, Node >= 20.9.0); it is an E2E package with nothing for vitest. clerkSetup() mints a Testing Token for the suite, setupClerkTestingToken() injects it per test; clerk.signIn({ page, signInParams: { strategy: 'email_code' | 'phone_code' | 'password', identifier, password? } }) or clerk.signIn({ page, emailAddress }), which "finds the user by email, creates a sign-in token using Clerk's backend API, and uses the ticket strategy"; needs CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY; email_code requires "a user with a test email as an identifier (e.g. [email protected])", and the docs mark phone_code as "only supported in development environments". [https://raw.githubusercontent.com/clerk/javascript/main/packages/testing/package.json], [https://raw.githubusercontent.com/clerk/javascript/main/packages/testing/src/playwright/helpers.ts], [https://clerk.com/docs/guides/development/testing/playwright/overview], [https://clerk.com/docs/guides/development/testing/playwright/test-helpers]
Testing Tokens: POST /v1/testing_tokens (operationId CreateTestingToken) -> { object: 'testing_token', token, expires_at } (createTestingToken()), "meant for use by end-to-end test suites in requests to the Frontend API, so as to bypass bot detection"; sent as __clerk_testing_token query param; short-lived, instance-bound. [https://clerk.com/docs/guides/development/testing/overview], [bapi/2026-05-12.yml]
Test emails: any +clerk_test subaddress, e.g. [email protected], verification code 424242, no email is sent for codes; enabling this on production is "highly discouraged". Dev instances get 100 emails and 20 SMS per calendar month from Clerk's sender; test addresses do not count. [https://clerk.com/docs/guides/development/testing/test-emails-and-phones]
Clerk's documented server-side flow: create a user (POST /v1/users), create a session (POST /v1/sessions, operationId createSession — the OpenAPI description says "This operation is intended only for use in testing, and is not available for production instances" and points backend-generated sessions at Sign-in Tokens instead), mint a token (POST /v1/sessions/{session_id}/tokens, operationId CreateSessionToken, optional expires_in_seconds 30–315360000), send Authorization: Bearer <jwt>; tokens default to 60 s so refresh before each test. [https://clerk.com/docs/guides/development/testing/overview], [bapi/2026-05-12.yml]
Own keypair through jwtKey — what the code does: verifyToken(token, { jwtKey }) first rejects a header cat equal to the M2M category, then calls loadClerkJwkFromPem, which strips -----BEGIN PUBLIC KEY-----/-----END PUBLIC KEY----- and the literal SPKI prefix MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA and suffix IDAQAB, then builds { kty: 'RSA', alg: 'RS256', e: 'AQAB', n } labeled kid: "local-<header kid>"; it never compares the header kid to anything. That prefix/suffix is the DER framing of a 2048-bit RSA key with exponent 65537, so the test keypair must be exactly RSA-2048 / e=65537 (any other size yields a garbage modulus and a signature failure). verifyJwt then asserts typ is JWT if present (an absent typ passes), alg in RS256|RS384|RS512 (RSASSA-PKCS1-v1_5 via WebCrypto), signature, sub is a string, aud only when both an audience option and an aud claim exist, azp when authorizedParties is given (then it must be present and match), exp, nbf, iat with clockSkewInMs default 5000; there is no iss check (a comment in keys.ts states "verifyJwt does not assert iss"). authenticateRequest additionally refuses, on both the header and cookie paths, any JWT whose typ is at+jwt/application/at+jwt, whose sub starts with mch_, or whose header cat is anything other than absent, the session category, or the ignore category (TokenTypeMismatch). So an RS256 JWT with header { alg, typ: 'JWT', kid } (no cat) and claims sub (user_…), sid, iat, nbf, exp (and azp matching your allowlist) signed by an RSA-2048 test keypair verifies through verifyToken/authenticateRequest with jwtKey set to that keypair's public PEM and no network. [https://raw.githubusercontent.com/clerk/javascript/main/packages/backend/src/tokens/keys.ts], [.../tokens/verify.ts], [.../tokens/request.ts], [.../tokens/machine.ts], [.../tokens/jwtCategories.ts], [.../jwt/verifyJwt.ts], [.../jwt/assertions.ts], [.../jwt/algorithms.ts] The docs describe jwtKey only as "Used to verify the session token in a networkless manner. Supply the PEM public key from the API keys page." [https://clerk.com/docs/reference/backend/verify-token] Clerk's own @clerk/backend suite does the equivalent: fixed mockJwtPayload/mockRsaJwk fixtures, a createJwt() helper and signJwt(), msw serving https://api.clerk.test/v1/jwks, vi.useFakeTimers(); vi.setSystemTime(mockJwtPayload.iat * 1000); keys.test.ts feeds a fixture PEM (mockPEMJwtKey) to loadClerkJwkFromPem and asserts the local-<kid> label. [https://raw.githubusercontent.com/clerk/javascript/main/packages/backend/src/fixtures/index.ts], [.../tokens/tests/verify.test.ts], [.../tokens/tests/keys.test.ts] Verdict: works by construction and mirrors how Clerk tests itself, but is not a documented, supported contract; pin @clerk/backend and keep one test that fails if loadClerkJwkFromPem changes shape. Nothing in Clerk's docs recommends anything for backend unit tests beyond the BAPI-minted-token flow above.
6. Development-instance limits and production needs
Dev: "capped at 100 users, and user data can not be transferred between instances"; a Development banner in the Dashboard; some social connections use shared credentials; email/SMS templates prefixed with the environment; Account Portal and OAuth screens on accounts.dev; the __clerk_db_jwt dev browser (query string) replaces the __client cookie. [https://clerk.com/docs/guides/development/managing-environments] Keys pk_test_/sk_test_ in development, pk_live_/sk_live_ in production. [https://clerk.com/docs/guides/development/deployment/production]
Production: create from the Development dropdown -> "Create production instance" (clone settings or defaults; "SSO connections, Integrations, and Paths settings do not copy over"); own a domain with DNS access; add the CNAME records the Domains page lists (FAPI clerk.<domain>, accounts.<domain>, and email ones — the count and exact host names are shown only in the Dashboard: unverified), up to 48 h propagation, Cloudflare must be "DNS only"; swap to pk_live_/sk_live_; own OAuth credentials; set authorizedParties; update webhooks and CSP; then "Deploy certificates". [https://clerk.com/docs/guides/development/deployment/production] JWKS for jwtKey-less verification: https://api.clerk.com/v1/jwks (secret key) or <FAPI>/.well-known/jwks.json; the PEM is on the API keys page. [https://clerk.com/docs/guides/sessions/manual-jwt-verification]
Open questions
A patch page with no script never refreshes __session, so every visit more than 60 s after the last one goes through the handshake redirect (server -> FAPI -> server). Acceptable, or does the "login door" host clerk-js to keep the token fresh?
In development the Account Portal ties the "home origin" to the browser at runtime; with no clerk-js in the app, whether <slug>.accounts.dev returns to a bare server with __clerk_db_jwt in the query is unverified and needs one manual run.
Which Redirects-tab fields exist (after sign-out in particular), the inactivity-timeout bounds, and the multi-session default are Dashboard-only facts; confirm in the instance.
Custom session lifetime and simultaneous sessions need Pro ($25/mo) in production; the 7-day fixed maximum on Free is the default anyway.
Google/Microsoft "verified" consent screens need a verified domain (Search Console / .well-known/microsoft-identity-association.json) and, for Microsoft, publisher verification; decide whether "unverified" on the Microsoft prompt is acceptable at launch.
Verification
Checked on 2026-09-02 against every cited URL, plus the newer sources where the citation was stale: @clerk/backend 3.17.0 and @clerk/testing 2.2.32 on clerk/javascript main (tokens/keys.ts, verify.ts, request.ts, handshake.ts, machine.ts, jwtCategories.ts, constants.ts, jwt/*, fixtures/index.ts, __tests__/keys.test.ts, __tests__/verify.test.ts, testing/src/playwright/helpers.ts, clerk-js cookie files), bapi/2025-03-12.yml and bapi/2026-05-12.yml, and 25 doc pages on clerk.com, support.google.com and learn.microsoft.com.
Confirmed as written: the server-side BAPI test flow and its token bounds; @clerk/testing exports; Account Portal URLs, redirect_url rule, allowedRedirectOrigins, disable behavior; Google/Microsoft dev vs production setup; GetUser fields and rate limits; dev-instance cap, +clerk_test/424242, 100 email/20 SMS quota; pricing and session-lifetime defaults; handshake trigger states and loop guard.
Changed: (1) jwtKey claim narrowed — the PEM parser hard-codes the RSA-2048/e=65537 SPKI prefix, typ is only checked when present, and authenticateRequest rejects JWTs with a machine typ, an mch_ sub, or a non-session cat header. (2) Handshake query parameter names corrected to __clerk_hs_reason and format=nonce. (3) Multi-session "off by default" downgraded to unverified (docs give no default). (4) __client_uat is Strict only when clerk-js sets it in dev; FAPI sets it Lax in production. (5) __session cookie: noted the docs/source disagreement (60 s vs 1 year). (6) Added jti to the session claims. (7) Username rule reworded (docs say no special characters, not "Latin"). (8) Dev-mode notice: scoped to what the changelog says; Account Portal display unverified. (9) pk_test_ citation moved to the production page. (10) Google: noted that Clerk's page says production status "requires verification" while Google's own page exempts basic scopes. (11) OpenAPI citation updated to 2026-05-12, the version @clerk/backend 3.17.0 pins; the older spec agrees. (12) Playwright clerk.signIn reworded to match the helper source (email_code needs a +clerk_test user; the dev-only note is on phone_code; the emailAddress path uses a sign-in token).
Still unverifiable from primary sources: inactivity-timeout numeric bounds, the Redirects-tab field list, whether name can be required at sign-up, whether the hosted /user page exposes sign-out, the CNAME record count/hostnames, whether the Account Portal shows the dev-mode notice, and the multi-session default.
Activity
allisonmahmood commentedon Sep 2, 2026
Resolution
Read on 2026-09-02 from clerk.com/docs (the docs moved under
/docs/guides/...; old paths redirect),clerk/javascriptmain (@clerk/backend3.17.0,@clerk/testing2.2.32),clerk/openapi-specs(bapi/2026-05-12.yml, the version@clerk/backend3.17.0 pins asSUPPORTED_BAPI_VERSION;bapi/2025-03-12.ymlsays the same on every point below), Google Cloud and Microsoft Learn. "Unverified" marks anything I could not pin to a primary page.1. Strategies: Google, Microsoft, email code, no passwords
Google. Dashboard: SSO connections -> Add connection -> For all users -> Google. Development instances use Clerk's "preconfigured shared OAuth credentials and redirect URIs — no other configuration is needed." Production: toggle "Enable for sign-up and sign-in" and "Use custom credentials", copy the Authorized Redirect URI Clerk shows, create an OAuth client ID (Web application) in Google Cloud -> APIs & Services -> Credentials, paste Client ID and Client Secret back. Google's OAuth consent screen must be set to "In production" before launch. Blocking of
+,=,#email subaddresses is on by default. [https://clerk.com/docs/guides/configure/auth-strategies/social-connections/google]Google's side: Testing status caps the app at 100 listed test users, shows them a warning, and their consent expires after 7 days; "In production" opens it to any Google account. Apps requesting only
userinfo.email,userinfo.profile,openidshow no warning and their authorizations do not expire. [https://support.google.com/cloud/answer/15549945] "If your app utilizes only non-sensitive scopes, it is not mandatory for your app to complete the app verification process"; the lighter "brand verification" is needed only to show an app name and logo on the consent screen. [https://support.google.com/cloud/answer/13463073] Clerk's Google page says the switch to "In production" "requires verification of your app name, logo, and requested scopes"; Google's own page above is the authority and contradicts that for basic scopes. Every domain in "Authorized domains" must be owned and verified in Google Search Console by a project owner/editor; the homepage must be on a verified domain and "can not be only a login page"; without brand verification only the app's domain shows on the consent screen, not name/logo. [https://support.google.com/cloud/answer/13464321], [https://support.google.com/cloud/answer/10311615]Microsoft. Same dashboard path with Microsoft. Dev: shared credentials. Production: Entra ID -> App registrations -> New registration, supported account types "Accounts in any organizational directory ... and personal Microsoft accounts", platform Web, the Redirect URI from Clerk; copy Application (client) ID; Certificates & secrets -> New client secret (expiry mandatory, default 6 months, max 24 months); under Authentication enable "Access tokens" and "ID tokens"; paste into Clerk. Clerk supports only the
commontenant and onlysecretcredentials (no certificates). nOAuth mitigation: add optional claimsemailandxms_pdlto both ID and access tokens, set"acceptMappedClaims": truein the manifest, replacexms_pdlwithxms_edovso Clerk can trust the email is verified. [https://clerk.com/docs/guides/configure/auth-strategies/social-connections/microsoft]Microsoft's side: a multitenant app registered after 2020-11-30 shows "unverified" on the consent prompt unless it is publisher-verified; publisher domain is set under Branding by hosting
https://<domain>/.well-known/microsoft-identity-association.json. Multitenant apps with a null publisher domain are restricted to one root domain across redirect URIs (localhost exempt). [https://learn.microsoft.com/en-us/entra/identity-platform/howto-configure-publisher-domain, page updated 2026-06-15]Email code. Dashboard User & authentication: "Email verification code: Users receive an OTP to their email address to sign in." 30-second cooldown between code requests; code valid 10 minutes. "Email verification link" is the alternative (link valid 10 minutes, optional "Require the same device and browser"). [https://clerk.com/docs/guides/configure/auth-strategies/sign-up-sign-in-options]
Passwords off. Same page, Password toggle: "Disabling Password will only affect new users. Existing users will still be able to sign in with their existing password." Turn it off before the first real user. With only email code enabled, the sign-in form asks for the email, then the code. [same page]
Sign-up form. Identifiers Email address / Phone number / Username are each Required or Optional; first and last name are governed by "Allow users to set their first and last name" in the User model section (whether name can be required at sign-up: unverified). Username, if enabled, is 4–64 characters with no special characters (
^$!.\#+~`). [same page] A Google/Microsoft sign-up creates the user from the provider profile (email, name, image) without a form; that inference follows from the connection docs but is not stated as such: unverified.Dev-mode notice in Clerk's UI components. Since 2024-08 Clerk's UI components in development instances carry a "Development mode" notice; the changelog says it "currently applies only to newly created applications" at that date and can be hidden with layout
unsafe_disableDevelopmentModeWarnings. Whether the hosted Account Portal pages show it: unverified. [https://clerk.com/changelog/2024-08-02-dev-notice]2. Account Portal (hosted pages)
Pages: sign-in (
<SignIn />), sign-up, user profile, unauthorized-sign-in (device revocation), create-organization, organization, waitlist. "After a user finishes a flow in Account Portal, Clerk redirects them to your application with the required authentication context." [https://clerk.com/docs/guides/account-portal/overview]URLs, production:
https://accounts.<domain>/sign-in,/sign-up,/user,/unauthorized-sign-in,/organization,/create-organization. Development: a randomly generated<slug>.accounts.devhost, same paths; the Frontend API in dev ishttps://<slug>.clerk.accounts.dev. Exact URLs are on the Dashboard's Account Portal -> Overview tab. In development "the development host (e.g., http://localhost:3000) is dynamically detected by Clerk at runtime and tied to your client browser" and stored as the "home origin", the equivalent of the app domain in production. [https://clerk.com/docs/guides/account-portal/getting-started], [https://clerk.com/docs/guides/how-clerk-works/overview]Direct link:
https://accounts.<domain>/<page>?redirect_url=<url>. "The redirect_url value must be a URL on your instance's domain or one of its subdomains, or share the same origin as the requesting page (which is why localhost works in development)." Withoutredirect_url, the Dashboard's Account Portal -> Redirects tab sets fallback URLs "for sign-in, sign-up, and other Account Portal flows" (exact field list: unverified). Prefill params:email_address,phone_number,username,first_name,last_name. [https://clerk.com/docs/guides/account-portal/direct-links]Redirect precedence in Clerk's SDK terms: a "force" redirect URL wins over everything including
redirect_url; otherwiseredirect_urlin the query wins over the fallback; fallbacks default to/. [https://clerk.com/docs/guides/development/customize-redirect-urls] clerk-js optionallowedRedirectOrigins: (string | RegExp)[]is "an array of domains to validate user-provided redirect URLs against. If no match is made, the redirect is considered unsafe and the default redirect will be used with a warning logged in the console";afterSignOutUrl,signInForceRedirectUrl,signInFallbackRedirectUrl(defaults to'/') exist as options. [https://clerk.com/docs/js-frontend/reference/objects/clerk]Disable: Account Portal page -> "Disable Account Portal" (bottom); only allowed once another auth flow exists; all portal pages then 404. [https://clerk.com/docs/guides/account-portal/disable-account-portal]
How the session reaches a server that runs no clerk-js (from
@clerk/backendsource, not a doc page):authenticateRequestreads__session,__client_uat,__clerk_db_jwt,__clerk_handshake,__clerk_handshake_nonceand theAuthorizationheader. With__client_uatbut no or expired__session(ClientUATWithoutSessionToken,SessionTokenExpired-refresh-*), or in dev with__clerk_db_jwtin the query or no dev-browser token at all (DevBrowserSync/DevBrowserMissing), it returns statushandshakewith aLocationto<FAPI>/v1/client/handshake?redirect_url=...&__clerk_api_version=2026-05-12&<suffixed-cookies flag>&__clerk_hs_reason=<reason>&format=nonce(plus__clerk_db_jwtin dev); on return it turns the handshake payload intoSet-Cookieheaders, in dev strips the handshake params and redirects again; loop guard cookie__clerk_redirect_count(SameSite=Lax; HttpOnly; Max-Age=2), stops at 3. With no cookies at all on a non-satellite production instance it returnssigned-out(SessionTokenAndUATMissing). [https://raw.githubusercontent.com/clerk/javascript/main/packages/backend/src/tokens/request.ts], [https://raw.githubusercontent.com/clerk/javascript/main/packages/backend/src/tokens/handshake.ts], [https://raw.githubusercontent.com/clerk/javascript/main/packages/backend/src/constants.ts] The docs describe the same loop for server-rendered apps: server returns a redirect, browser follows to FAPI, FAPI "issues a new session token." [https://clerk.com/docs/guides/how-clerk-works/overview]Sign-out: there is no hosted sign-out page in the Account Portal list.
clerk.signOut({ sessionId?, redirectUrl? })in clerk-js signs out all sessions (multi-session) or the current one; other devices stay signed in. [https://clerk.com/docs/guides/development/custom-flows/authentication/sign-out] Server side:revokeSession(sessionId)/POST /v1/sessions/{session_id}/revoke"Revokes the given session. The user will be signed out from the client the session is associated with." [https://clerk.com/docs/reference/backend/sessions/revoke-session] The user-profile page (/user) is the hosted<UserProfile />, which in Clerk's components carries the sign-out control (unverified that the hosted page exposes it).3. Sessions
Dashboard Sessions page (
dashboard.clerk.com/~/sessions). Inactivity timeout: disabled by default; "a user is considered inactive when the application is closed, or when the app stops refreshing the token"; "requires a paid plan for production use, but all features are free to use in development mode"; numeric bounds: unverified. Maximum lifetime: "enabled with a default value of 7 days for all newly created instances"; custom values need a paid plan in production. "Either one or both must be enabled at all times." Multi-session handling: a toggle on the same page ("Toggle on Multi-session handling"); the docs do not state its default, so "off by default" is unverified (the pricing page's Free plan excluding "Simultaneous sessions" implies it cannot be on for Free). Chrome signs users out within 400 days regardless of the setting. These settings "are Dashboard-only and can't be changed via the CLI or Backend API." [https://clerk.com/docs/guides/secure/session-options] Pricing confirms the gate: Free plan "Fixed, 7 day session lifetime" and no "Simultaneous sessions"; Pro ($25/mo, $20/mo billed annually) unlocks custom session duration, branding removal, allowlist/blocklist, simultaneous sessions; Free is 50,000 MRU with Clerk branding. [https://clerk.com/pricing]Session JWT: lifetime 60 seconds, refreshed by clerk-js "on a 50-second interval (allowing 10 seconds for network latency)" via
/client/sessions/<id>/tokens[https://clerk.com/docs/guides/how-clerk-works/overview]; default claims (v2)azp(theOriginheader of the FAPI request),exp,fva,iat,iss(FAPI URL),jti,nbf,sid,sub,v,pla,fea,sts,owhen an org is active. Keep custom claims under 1.2 KB (4 KB cookie limit). [https://clerk.com/docs/guides/sessions/session-tokens]Cookies (docs + clerk-js source):
__clientHttpOnly JWT on the FAPI domain (clerk.<domain>),SameSite=Lax, browser-limited lifetime;__sessionon the app host, not HttpOnly, noDomainattribute ("scoped strictly so it cannot be shared across subdomains"),SameSite=Lax(Nonewhen partitioned or in a cross-origin iframe). Cookie expiry: the docs page says "Expiration: 60 seconds" while clerk-js setsexpires = addYears(Date.now(), 1); the JWT inside expires in 60 s either way.__client_uatvalue = clientupdated_atseconds or0, 1 year, domain fromgetCookieDomain(); clerk-js sets itSameSite=Strictin development, and the source comment says in production FAPI sets it withLax.__clerk_db_jwtdev-only, passed as a query string because localhost andaccounts.devare cross-site; "Do not rely on__clerk_db_jwtin your application code, as it will break in production." [https://clerk.com/docs/guides/how-clerk-works/overview], [https://raw.githubusercontent.com/clerk/clerk-docs/main/docs/_partials/clerkdbjwt-vs-client-cookie.mdx], [https://raw.githubusercontent.com/clerk/javascript/main/packages/clerk-js/src/core/auth/cookies/session.ts], [https://raw.githubusercontent.com/clerk/javascript/main/packages/clerk-js/src/core/auth/cookies/clientUat.ts]4. Backend API: one user by id
GET https://api.clerk.com/v1/users/{user_id}(operationIdGetUser), Bearer secret key. User wire fields:id,external_id,username,first_name,last_name,profile_image_url(deprecated alias),image_url,has_image,email_addresses[],primary_email_address_id,external_accounts[],last_sign_in_at,created_at,updated_at,banned,locked. [https://raw.githubusercontent.com/clerk/openapi-specs/refs/heads/main/bapi/2026-05-12.yml] SDK:clerkClient.users.getUser(userId: string): Promise<User>withfirstName: null | string,lastName: null | string,fullName(accessor),imageUrl: string,hasImage: boolean,primaryEmailAddressId: null | string,emailAddresses: EmailAddress[],externalAccounts: ExternalAccount[]. [https://clerk.com/docs/reference/backend/user/get-user], [https://clerk.com/docs/reference/backend/types/backend-user]Rate limits, per instance: production 1,000 requests / 10 s, development 100 / 10 s; JWKS unlimited; user metadata updates 10 / 10 s per user; 429 with
Retry-Aftergiving "the number of seconds after which the block expires". Frontend API per user/IP: sign-in/sign-up creation 5 / 10 s, attempts 3 / 10 s. [https://clerk.com/docs/guides/how-clerk-works/system-limits]5. Testing without a browser
@clerk/testing2.2.32 exports only./playwright,./playwright/unstable,./cypress(optional peer deps@playwright/test ^1,cypress ^13||^14||^15, Node >= 20.9.0); it is an E2E package with nothing for vitest.clerkSetup()mints a Testing Token for the suite,setupClerkTestingToken()injects it per test;clerk.signIn({ page, signInParams: { strategy: 'email_code' | 'phone_code' | 'password', identifier, password? } })orclerk.signIn({ page, emailAddress }), which "finds the user by email, creates a sign-in token using Clerk's backend API, and uses the ticket strategy"; needsCLERK_PUBLISHABLE_KEYandCLERK_SECRET_KEY;email_coderequires "a user with a test email as an identifier (e.g. [email protected])", and the docs markphone_codeas "only supported in development environments". [https://raw.githubusercontent.com/clerk/javascript/main/packages/testing/package.json], [https://raw.githubusercontent.com/clerk/javascript/main/packages/testing/src/playwright/helpers.ts], [https://clerk.com/docs/guides/development/testing/playwright/overview], [https://clerk.com/docs/guides/development/testing/playwright/test-helpers]Testing Tokens:
POST /v1/testing_tokens(operationIdCreateTestingToken) ->{ object: 'testing_token', token, expires_at }(createTestingToken()), "meant for use by end-to-end test suites in requests to the Frontend API, so as to bypass bot detection"; sent as__clerk_testing_tokenquery param; short-lived, instance-bound. [https://clerk.com/docs/guides/development/testing/overview], [bapi/2026-05-12.yml]Test emails: any
+clerk_testsubaddress, e.g.[email protected], verification code424242, no email is sent for codes; enabling this on production is "highly discouraged". Dev instances get 100 emails and 20 SMS per calendar month from Clerk's sender; test addresses do not count. [https://clerk.com/docs/guides/development/testing/test-emails-and-phones]Clerk's documented server-side flow: create a user (
POST /v1/users), create a session (POST /v1/sessions, operationIdcreateSession— the OpenAPI description says "This operation is intended only for use in testing, and is not available for production instances" and points backend-generated sessions at Sign-in Tokens instead), mint a token (POST /v1/sessions/{session_id}/tokens, operationIdCreateSessionToken, optionalexpires_in_seconds30–315360000), sendAuthorization: Bearer <jwt>; tokens default to 60 s so refresh before each test. [https://clerk.com/docs/guides/development/testing/overview], [bapi/2026-05-12.yml]Own keypair through
jwtKey— what the code does:verifyToken(token, { jwtKey })first rejects a headercatequal to the M2M category, then callsloadClerkJwkFromPem, which strips-----BEGIN PUBLIC KEY-----/-----END PUBLIC KEY-----and the literal SPKI prefixMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAand suffixIDAQAB, then builds{ kty: 'RSA', alg: 'RS256', e: 'AQAB', n }labeledkid: "local-<header kid>"; it never compares the headerkidto anything. That prefix/suffix is the DER framing of a 2048-bit RSA key with exponent 65537, so the test keypair must be exactly RSA-2048 / e=65537 (any other size yields a garbage modulus and a signature failure).verifyJwtthen assertstypisJWTif present (an absenttyppasses),alginRS256|RS384|RS512(RSASSA-PKCS1-v1_5 via WebCrypto), signature,subis a string,audonly when both anaudienceoption and anaudclaim exist,azpwhenauthorizedPartiesis given (then it must be present and match),exp,nbf,iatwithclockSkewInMsdefault 5000; there is noisscheck (a comment in keys.ts states "verifyJwtdoes not assertiss").authenticateRequestadditionally refuses, on both the header and cookie paths, any JWT whosetypisat+jwt/application/at+jwt, whosesubstarts withmch_, or whose headercatis anything other than absent, the session category, or the ignore category (TokenTypeMismatch). So an RS256 JWT with header{ alg, typ: 'JWT', kid }(nocat) and claimssub(user_…),sid,iat,nbf,exp(andazpmatching your allowlist) signed by an RSA-2048 test keypair verifies throughverifyToken/authenticateRequestwithjwtKeyset to that keypair's public PEM and no network. [https://raw.githubusercontent.com/clerk/javascript/main/packages/backend/src/tokens/keys.ts], [.../tokens/verify.ts], [.../tokens/request.ts], [.../tokens/machine.ts], [.../tokens/jwtCategories.ts], [.../jwt/verifyJwt.ts], [.../jwt/assertions.ts], [.../jwt/algorithms.ts] The docs describejwtKeyonly as "Used to verify the session token in a networkless manner. Supply the PEM public key from the API keys page." [https://clerk.com/docs/reference/backend/verify-token] Clerk's own@clerk/backendsuite does the equivalent: fixedmockJwtPayload/mockRsaJwkfixtures, acreateJwt()helper andsignJwt(), msw servinghttps://api.clerk.test/v1/jwks,vi.useFakeTimers(); vi.setSystemTime(mockJwtPayload.iat * 1000);keys.test.tsfeeds a fixture PEM (mockPEMJwtKey) toloadClerkJwkFromPemand asserts thelocal-<kid>label. [https://raw.githubusercontent.com/clerk/javascript/main/packages/backend/src/fixtures/index.ts], [.../tokens/tests/verify.test.ts], [.../tokens/tests/keys.test.ts] Verdict: works by construction and mirrors how Clerk tests itself, but is not a documented, supported contract; pin@clerk/backendand keep one test that fails ifloadClerkJwkFromPemchanges shape. Nothing in Clerk's docs recommends anything for backend unit tests beyond the BAPI-minted-token flow above.6. Development-instance limits and production needs
Dev: "capped at 100 users, and user data can not be transferred between instances"; a
Developmentbanner in the Dashboard; some social connections use shared credentials; email/SMS templates prefixed with the environment; Account Portal and OAuth screens onaccounts.dev; the__clerk_db_jwtdev browser (query string) replaces the__clientcookie. [https://clerk.com/docs/guides/development/managing-environments] Keyspk_test_/sk_test_in development,pk_live_/sk_live_in production. [https://clerk.com/docs/guides/development/deployment/production]Production: create from the Development dropdown -> "Create production instance" (clone settings or defaults; "SSO connections, Integrations, and Paths settings do not copy over"); own a domain with DNS access; add the CNAME records the Domains page lists (FAPI
clerk.<domain>,accounts.<domain>, and email ones — the count and exact host names are shown only in the Dashboard: unverified), up to 48 h propagation, Cloudflare must be "DNS only"; swap topk_live_/sk_live_; own OAuth credentials; setauthorizedParties; update webhooks and CSP; then "Deploy certificates". [https://clerk.com/docs/guides/development/deployment/production] JWKS forjwtKey-less verification:https://api.clerk.com/v1/jwks(secret key) or<FAPI>/.well-known/jwks.json; the PEM is on the API keys page. [https://clerk.com/docs/guides/sessions/manual-jwt-verification]Open questions
__session, so every visit more than 60 s after the last one goes through the handshake redirect (server -> FAPI -> server). Acceptable, or does the "login door" host clerk-js to keep the token fresh?<slug>.accounts.devreturns to a bare server with__clerk_db_jwtin the query is unverified and needs one manual run..well-known/microsoft-identity-association.json) and, for Microsoft, publisher verification; decide whether "unverified" on the Microsoft prompt is acceptable at launch.Verification
Checked on 2026-09-02 against every cited URL, plus the newer sources where the citation was stale:
@clerk/backend3.17.0 and@clerk/testing2.2.32 onclerk/javascriptmain (tokens/keys.ts,verify.ts,request.ts,handshake.ts,machine.ts,jwtCategories.ts,constants.ts,jwt/*,fixtures/index.ts,__tests__/keys.test.ts,__tests__/verify.test.ts,testing/src/playwright/helpers.ts,clerk-jscookie files),bapi/2025-03-12.ymlandbapi/2026-05-12.yml, and 25 doc pages on clerk.com, support.google.com and learn.microsoft.com.Confirmed as written: the server-side BAPI test flow and its token bounds;
@clerk/testingexports; Account Portal URLs,redirect_urlrule,allowedRedirectOrigins, disable behavior; Google/Microsoft dev vs production setup; GetUser fields and rate limits; dev-instance cap,+clerk_test/424242, 100 email/20 SMS quota; pricing and session-lifetime defaults; handshake trigger states and loop guard.Changed: (1)
jwtKeyclaim narrowed — the PEM parser hard-codes the RSA-2048/e=65537 SPKI prefix,typis only checked when present, andauthenticateRequestrejects JWTs with a machinetyp, anmch_sub, or a non-sessioncatheader. (2) Handshake query parameter names corrected to__clerk_hs_reasonandformat=nonce. (3) Multi-session "off by default" downgraded to unverified (docs give no default). (4)__client_uatisStrictonly when clerk-js sets it in dev; FAPI sets itLaxin production. (5)__sessioncookie: noted the docs/source disagreement (60 s vs 1 year). (6) Addedjtito the session claims. (7) Username rule reworded (docs say no special characters, not "Latin"). (8) Dev-mode notice: scoped to what the changelog says; Account Portal display unverified. (9)pk_test_citation moved to the production page. (10) Google: noted that Clerk's page says production status "requires verification" while Google's own page exempts basic scopes. (11) OpenAPI citation updated to2026-05-12, the version@clerk/backend3.17.0 pins; the older spec agrees. (12) Playwrightclerk.signInreworded to match the helper source (email_code needs a+clerk_testuser; the dev-only note is on phone_code; theemailAddresspath uses a sign-in token).Still unverifiable from primary sources: inactivity-timeout numeric bounds, the Redirects-tab field list, whether name can be required at sign-up, whether the hosted
/userpage exposes sign-out, the CNAME record count/hostnames, whether the Account Portal shows the dev-mode notice, and the multi-session default.