Skip to main content

Recommended: JavaScript SDK with React Hooks

For new React apps, we recommend the JavaScript SDK with React Hooks (@dynamic-labs-sdk/react-hooks) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the React quickstart (JavaScript SDK) to get started.
This guide is currently React only.

Step-by-Step Guide

This guide shows you how to use Dynamic for authentication and as a signer for Crossmint Smart Wallets.
1

Create a Crossmint API Key

The first step is to obtain a client-side API key from Crossmint.
  1. Navigate to the “Integrate” section on the left navigation bar of the Crossmint console, and ensure you’re on the “API Keys” tab.
  2. Within the Client-side keys section, click the “Create new key” button in the top right.
  3. On the authorized origins section, enter http://localhost:3000 and click “Add origin”.
  4. Next, check the scopes labeled wallets.create, wallets.read, users.create.
  5. Check the “JWT Auth” box.
  6. Finally, create your key and save it for subsequent steps.
2

Configure Dynamic Authentication for your API Key

After the key is generated, you need to set it to require Dynamic auth tokens for authorization.
  1. Go to the Dynamic dashboard at https://app.dynamic.xyz/
  2. Select an existing project or create a new one
You need to make sure you’re using live keys for mainnets and sandbox keys for staging/testnets.
Dynamic Dashboard
  1. Expand the “Developers” section in the left-hand navigation and select “SDK and API Keys” to find your Dynamic Environment ID.
Dynamic Dashboard
  1. Copy the Dynamic Environment ID and return to the Crossmint developer console
  2. Within the JWT authentication section, select “3P Auth providers” option, and then select Dynamic
  3. Add your Environment ID and save changes
Dynamic Dashboard
3

Configure Chain Support in Dynamic

To integrate Crossmint Smart Wallets with Dynamic as the auth provider, you need to configure the chain you want to use:
  1. With the same project selected, select the “Chains and Networks” option in the left-hand navigation
  2. Click the EVM option to reveal a drawer where you can toggle chain support on and off
Dynamic Dashboard
  1. Enable the desired chain for smart wallet support (in this example, we’ll use polygon-amoy)
Dynamic Dashboard
4

Install Required Dependencies

Install the Crossmint React UI SDK and Dynamic packages:
Then, set up shadcn UI components:
Install the button and card components:
5

Configure Environment Variables

Add your Crossmint client-side API key and Dynamic Environment ID to your environment file:
6

Create the Provider Components

First, create a CrossmintDynamicProvider component that will wrap your application:
components/providers/CrossmintDynamicProvider.tsx
Now create a custom hook that connects Dynamic with Crossmint:
hooks/useDynamicConnector.tsx
7

Update Your Layout

Update your app’s layout to use the CrossmintDynamicProvider:
app/layout.tsx
8

Create UI Components

Create a component that uses the Dynamic connector and displays wallet information:
components/WalletCard.tsx
9

Create Your Main Page

Create your main page that uses the WalletCard component:
app/page.tsx
10

Launch and Test

  1. Start your development server:
  1. Visit http://localhost:3000 in your browser
  2. Click the Dynamic widget to start the authentication flow
  3. Follow the prompts to authenticate using Dynamic
  4. Once logged in, you should see both your Dynamic wallet address and your Crossmint Smart Wallet address

How It Works

The integration between Dynamic and Crossmint involves these key components:
  1. Authentication Flow:
    • User connects wallet using Dynamic’s authentication
    • Dynamic provides the wallet and authentication token (JWT)
    • The Crossmint SDK uses the JWT from Dynamic to authenticate with Crossmint
  2. Wallet Creation:
    • The useDynamicConnector hook retrieves the primary wallet from Dynamic
    • It gets the wallet client from the Dynamic wallet to use as a signer
    • It creates a Crossmint Smart Wallet using the Dynamic wallet as the signer
  3. Key Benefits:
    • Users leverage their existing Dynamic authentication
    • No new key management required
    • The Dynamic wallet serves as a signer for the Crossmint Smart Wallet
    • Cross-chain support through Crossmint’s infrastructure
  • Dynamic Wallet: The primary signer that controls the Crossmint Smart Wallet
  • Crossmint Smart Wallet: A fully-featured EVM wallet with gas sponsorship capabilities
  • The user authenticates with Dynamic, but gains access to Crossmint’s advanced wallet infrastructure
The integration relies on JWT tokens for secure authentication:
  1. Dynamic issues a JWT token upon user authentication
  2. The Crossmint SDK uses this JWT to authenticate the user with Crossmint
  3. The JWT handling is abstracted away in the useCrossmint hook
  4. Tokens are automatically refreshed as needed
Module not found: Can’t resolve rpc-websockets/dist/lib/clientAdd this to your package.json:
Chain mismatch errors between Dynamic and WagmiEnsure your Dynamic environment is configured for the same chain you’re using in your app. Check the Dynamic.xyz dashboard and make sure the chain is enabled.
Last modified on June 25, 2026