Skip to main content
This page has been updated for Wallets SDK V1. If you are using the previous version, see the previous version of this page or the V1 migration guide.
Crossmint provides connectors for the most popular auth providers, including Auth0, Firebase, Supabase, Stytch, Cognito, and Kinde. When you bring your own auth, Crossmint automatically extracts the user ID from your provider’s JWT and assigns it to the wallet’s owner property. Wallet creation, transaction signing, and balance reads all work the same way regardless of which auth provider you use. If you are just getting started or prototyping, Crossmint Auth is a great way to move fast in staging before connecting your own provider.

Prerequisites

  • API Key: Ensure you have an API key with the scopes: wallets.create.

Using your own auth provider

1

Configure JWT Authentication in the Crossmint Console

  1. Navigate to your project in the Crossmint Console.
  2. Go to the API Keys section from the sidebar.
  3. Scroll down to the JWT authentication section.
  4. Choose your preferred authentication method:
  • 3P Auth providers: Select from supported providers such as Auth0, Stytch, Cognito, Firebase, Kinde, or Supabase. Enter any required environment IDs or configuration details.
  • Custom tokens: Opt to issue and manage your own JWTs.
  1. After making your selection and providing any necessary details, click Save JWT auth settings to apply your configuration.
JWT Authentication Settings
2

Add the Crossmint providers to your app

Add the necessary Crossmint providers to your app together with your own auth provider.
"use client";

import { useEffect } from "react";
import {
    CrossmintProvider,
    CrossmintWalletProvider,
    useCrossmint,
} from "@crossmint/client-sdk-react-ui";

import { YourAuthProvider, useYourAuthProviderHook } from "@your-auth-provider";

export function Providers({ children }: { children: React.ReactNode }) {
    return (
        <YourAuthProvider>
            <CrossmintProvider apiKey="YOUR_CLIENT_API_KEY">
                <CrossmintWalletProvider>
                    <JwtSync />
                    {children}
                </CrossmintWalletProvider>
            </CrossmintProvider>
        </YourAuthProvider>
    );
}

// Get the JWT from your auth provider and pass it to the Crossmint provider
function JwtSync() {
    const { jwt } = useYourAuthProviderHook();
    const { setJwt } = useCrossmint();

    useEffect(() => {
        setJwt(jwt);
    }, [jwt]);

    return null;
}
3

Pass the JWT and create or retrieve the wallet

Once the JWT is available, use getWallet to retrieve an existing wallet. If no wallet exists, it throws a WalletNotAvailableError — catch it and call createWallet instead.
"use client";

import { useYourAuthProviderHook } from "@your-auth-provider";
import { useEffect } from "react";
import { useCrossmint, useWallet } from "@crossmint/client-sdk-react-ui";
import { WalletNotAvailableError } from "@crossmint/wallets-sdk";

export function YourComponent() {
    const { email } = useYourAuthProviderHook();
    const { jwt } = useCrossmint();
    const { getWallet, createWallet } = useWallet();

    useEffect(() => {
        if (email != null && jwt != null) {
            getWallet({ chain: "base-sepolia" }).catch((error) => {
                if (error instanceof WalletNotAvailableError) {
                    createWallet({
                        chain: "base-sepolia",
                        recovery: { type: "email", email },
                    }).catch(console.error);
                }
            });
        }
    }, [email, jwt]);

    // your component logic here
    return (
        <div>
            <h1>Your Component</h1>
        </div>
    );
}
getOrCreateWallet has been removed in V1. Use getWallet to retrieve an existing wallet. If it throws a WalletNotAvailableError, call createWallet instead. See the migration guide for details.
4
See the React SDK reference for more details on providers and hooks.