Skip to main content
Crossmint Auth is designed for staging and moving fast. For production applications, Crossmint strongly recommends connecting your own authentication provider for full control over user management. See the Bring Your Own Auth guide.

Prerequisites

  • Staging project: Create a project in the Crossmint staging Console.
  • Client-side API key: Create a key with the users.create, users.read, and wallets.read scopes. In staging, all scopes are included by default.
  • Server-side API key: For the server examples, use a key with the users.read scope.

When to Use Crossmint Auth

Use Crossmint Auth for staging, demos, and prototypes. It supports email OTP, social sign-in with Google, Apple, or X, Farcaster, and external wallets. React web includes a login modal. React Native and Flutter use headless flows.

Setup

Install the React SDK:
Add CrossmintProvider and CrossmintAuthProvider to your app. Use useCrossmintAuth() to sign in and out.
Providers.tsx
AuthButton.tsx
For Swift and Kotlin, see the Crossmint Auth (OTP) tab in the Swift and Kotlin quickstarts.

Check That It Works

Start the React app, sign in, and confirm that your email appears.

Login Methods

Set loginMethods on CrossmintAuthProvider to choose which methods appear. Email and Google are enabled by default.
Providers.tsx
Supported methods include email OTP, social accounts, Farcaster, and external wallets. Use "web3:evm-only" or "web3:solana-only" to limit external wallet types.

Customize the Login Modal

Set authModalTitle, termsOfServiceText, and appearance on CrossmintAuthProvider to customize the login modal.

Read the User Profile

Use useCrossmintAuth().user to read the signed-in user’s profile:

Verify Sessions on Your Server

Install @crossmint/server-sdk and create CrossmintAuth with a server-side API key that has the users.read scope. Use getSession to validate or refresh a session. Use verifyCrossmintJwt to verify a JWT:
session-route.ts
See the TypeScript SDK reference for the full API.

Protect Session Tokens

By default, client-side JavaScript can access Crossmint Auth tokens. You can set secure cookie options for the refresh token. The session JWT remains available to client-side JavaScript because the client SDK needs it for API calls. Add refresh and logout routes to your server. The server stores the refresh token in an httpOnly cookie:
server.ts
Point CrossmintAuthProvider to these routes:
Providers.tsx

User Webhooks

Crossmint sends the users.created event when a user signs up with Crossmint Auth. The id field identifies the user. The email and phoneNumber fields appear when the user signs up with the matching method.
Return a quick 2xx response to confirm delivery.

Move to Production

For production, connect your own auth provider with the Bring Your Own Auth guide. Then configure JWT Authentication in the Crossmint Console.

Next Steps

Use Your Own Auth Provider

JWT Authentication

React Wallet Quickstart

Crossmint Auth TypeScript SDK