Clerk Documentation

website·Indexed Jun 3, 2026

https://clerk.com/docs/

Developer documentation for Clerk, covering authentication guides for various frameworks including Next.js, React, Vue, Nuxt, Astro, Go, Ruby, and Express. Includes technical references for backend APIs, custom authentication flows like embeddable email links with sign-in tokens, session management, and billing objects.

Tokens
1.1M
Snippets
2.9K
Records
6.2K
Agent score
50%

What's inside Clerk

  1. Overview of Social Connections (OAuth) in Clerk

    Clerk allows you to integrate social authentication providers (OAuth) such as Google, Facebook, GitHub, and others into your application. Implementation details vary depending on your frontend or backend framework. Supported environments include Next.js, React, Expo, TanStack React Start, React Router, Express, Android, Astro, and Chrome Extensions.
  2. Overview of Clerk UI Components

    Clerk provides a suite of pre-built components for integrating authentication, user management, multi-tenancy (organizations), and billing into applications. These components are categorized by their primary function: Authentication, User management, Organization management, Billing, and Control flow.
  3. Overview of Clerk Nuxt components

    Clerk provides a suite of pre-built components for Nuxt applications to handle authentication, user management, multi-tenancy (organizations), billing, and application flow control. These components can be categorized into several functional groups to help build SaaS applications quickly.
  4. Overview of key Clerk SDK objects

    Clerk's SDKs are built around several core objects that manage authentication, user data, and application state. Most interactions occur through these objects, either directly or via hooks and helpers.

    Key objects include:

    • Clerk: The main entry point for the SDK.
    • Client: Represents the current device or software (browser, native app, etc.).
    • Session: Represents the secure authentication state of a user. A single client can hold multiple sessions.
    • User: Represents the authenticated user, containing profile information (name, email, phone) and metadata (public, private, and unsafe).
    • SignIn / SignInFuture: Manages the sign-in lifecycle, including multi-factor authentication and session creation. SignInFuture is the recommended version for custom flows.
    • SignUp / SignUpFuture: Manages the sign-up process and user creation. SignUpFuture is the recommended version for custom flows.
    • Organization: Manages user access to resources, roles, and permissions within groups. A user can belong to multiple organizations, with one set as the 'Active Organization' for the session.
    • APIKeys: Used to manage long-lived tokens that allow third-party services to access your API on behalf of users.
    • Billing: Provides methods to manage billing plans, payment attempts, and subscriptions for users or organizations.
  5. Overview of Clerk Machine Authentication types

    Clerk provides three distinct methods for machine-to-machine (M2M) authentication, depending on the security model and the entity being authenticated:

    1. OAuth access tokens: Used to authenticate requests to Clerk's API on behalf of a human user. Clerk primarily supports the authorization code flow. Note: The client credentials flow is not currently supported.
    2. M2M tokens: Designed for authenticating requests between different services within your own infrastructure. This allows you to define specific machines and control which machines are permitted to communicate with each other.
    3. API keys: Designed for user-delegated access. This allows your application's users to generate keys (via the <UserProfile /> component or custom hooks) to delegate access to your application's API on their behalf. These keys can be revoked instantly.
  6. Overview of key Clerk SDK objects

    Clerk's SDKs are built around several core objects that manage authentication, user identity, and application state. Most interactions occur through these objects, either directly or via composables and helpers.

    Key objects include:

    • Clerk: The main entry point for the SDK; all other objects are accessible from here.
    • Client: Represents the current device or software (e.g., browser, native app) accessing the application.
    • Session: A secure representation of the current user's authentication state. A single client can hold multiple sessions.
    • User: Represents the authenticated user, containing profile information (name, email, phone) and metadata (public, private, and unsafe).
    • SignIn / SignInFuture: Manages the sign-in lifecycle, including multi-factor authentication and session creation. SignInFuture is the recommended version for custom flows.
    • SignUp / SignUpFuture: Manages the sign-up process and user creation. SignUpFuture is the recommended version for custom flows.
    • Organization: Manages user access to resources, roles, and permissions within groups. A user can belong to multiple organizations, with one set as the 'Active Organization'.
    • APIKeys: Used to manage long-lived tokens that allow users to grant third-party services programmatic access to your API.
    • Billing: Provides methods to manage billing plans, payment attempts, and subscriptions for users or organizations.
  7. Overview of Passkey Authentication

    Passkeys are a phishing-resistant, passwordless authentication method based on the WebAuthn standard. They use public-key cryptography where a device generates a key pair: the private key remains securely stored on the user's device (unlocked via biometrics or PIN), and only the public key is stored on the server.

    Key benefits include:

    • Phishing Resistance: Private keys only respond to the specific registering domain.
    • MFA by Default: Combines device possession with local biometric/PIN verification.
    • Reduced Server Risk: Servers store public keys instead of reusable secrets (passwords).
    • Improved UX: Faster sign-in flows without the need to remember passwords.
  8. Overview of the GoogleOneTap component

    The <GoogleOneTap /> component renders the Google One Tap UI, allowing users to sign up or sign in to your Clerk application using their Google accounts with a single button.

    Prerequisites:

    • You must enable Google as a social connection in the Clerk Dashboard.
    • You must use custom credentials.

    Behavioral Notes:

    • Automatic Hiding: The component does not render if the user is already signed into your Clerk application.
    • Redirection: By default, users are redirected back to the page where the authentication flow started. This can be overridden using force redirect URL props or environment variables.
  9. Overview of Clerk Vue components

    Clerk provides a suite of pre-built Vue components for integrating authentication, user management, multi-tenancy (organizations), and billing into applications. The components are categorized into several functional groups:

    • Authentication: Components for signing in, signing up, and managing authentication tasks (e.g., <SignIn />, <SignUp />, <GoogleOneTap />).
    • User: Components for displaying and managing user identity (e.g., <UserButton />, <UserProfile />).
    • Organization: Components for multi-tenant/SaaS features (e.g., <OrganizationSwitcher />, <CreateOrganization />).
    • Billing: Components for managing subscriptions and pricing (e.g., <PricingTable />, <CheckoutButton />).
    • Control: Components that manage application flow and conditional rendering based on authentication state (e.g., <ClerkLoaded />, <Show />).
    • Unstyled & Utilities: Low-level components for custom implementations.
  10. Overview of the legacy SignIn object

    The SignIn object (Legacy) manages the state of a sign-in attempt and provides methods to navigate the authentication lifecycle, including first-factor and second-factor verification.

    Warning: This is a legacy API. It is recommended to upgrade to Core 3 and use the SignInFuture object instead.

    Standard Sign-in Lifecycle

    1. Initiate: Call create() with user authentication information.
    2. Prepare First Factor: Call prepareFirstFactor() (e.g., for password, email link, OTP, or Web3 wallet).
    3. Attempt First Factor: Call attemptFirstFactor() to verify the first factor.
    4. Prepare Second Factor (Optional): If MFA is enabled, call prepareSecondFactor().
    5. Attempt Second Factor: Call attemptSecondFactor() to verify the second factor.
    6. Complete: If successful, use SignIn.createdSessionId with the Clerk.setActive() method to establish the session.
  11. Overview of Clerk React Router components

    Clerk provides a suite of pre-built components for React Router applications to handle authentication, user management, multi-tenancy (organizations), billing, and application flow control. These components can be customized to match your application's branding and requirements.
  12. Overview of Clerk Native Mobile SDKs

    Clerk provides native SDKs to add authentication and user management directly to mobile applications. Support is available for both Android and iOS platforms via dedicated SDKs.