How to integrate Privy as an external signer for Crossmint Smart Wallets
This guide shows how to integrate Privy as an external signer for Crossmint Smart Wallets. Users authenticate with Privy, and their Privy wallet serves as a signer for a Crossmint Smart Wallet.
Create an API Key
The first step for integrating Privy is to obtain a client-side API key.
Navigate to the "Integrate" section on the left navigation bar, and ensure you're on the "API Keys" tab.
Within the Client-side keys section, click the "Create new key" button in the top right.
On the authorized origins section, enter http://localhost:3000
and click "Add origin".
Next, check the scopes labeled wallets.create
, wallets.read
, users.create
.
Check the "JWT Auth" box.
Finally, create your key and save it for subsequent steps.
Configure Privy for your API Key
After the key is generated, you need to set it to accept Privy auth tokens for authorization.
When you’re ready to move to production/mainnet with Privy, you will need to complete the “Upgrade to production” steps in the Privy dashboard (Settings > Basic > Application state).
Install Required Dependencies
Install the Crossmint React UI SDK and shadcn UI components:
Then, set up shadcn UI components:
Install the button and card components:
Configure Environment Variables
Add your Crossmint client-side API key and Privy App ID to your environment file:
Create the Provider Components
First, create a CrossmintPrivyProvider component that will wrap your application:
Now create a custom hook that connects Privy with Crossmint:
Update Your Layout
Update your app’s layout to use the CrossmintPrivyProvider:
Create UI Components
Create a component that uses the Privy connector and displays wallet information:
Create Your Main Page
Create your main page that uses the WalletCard component:
Launch and Test
The integration between Privy and Crossmint involves these key components:
Wallet Integration Flow:
Wallet Creation:
usePrivyConnector
hook finds the Privy walletKey Benefits:
Understanding Wallet Relationships
Handling JWT Authentication
The integration relies on JWT tokens for secure authentication:
useCrossmint
hookBest Practices
For more information on working with Crossmint Smart Wallets, check out these resources:
Send native tokens between wallets.
Send ERC20 and other tokens.
Check wallet balances.
Get NFTs owned by a wallet.
How to integrate Privy as an external signer for Crossmint Smart Wallets
This guide shows how to integrate Privy as an external signer for Crossmint Smart Wallets. Users authenticate with Privy, and their Privy wallet serves as a signer for a Crossmint Smart Wallet.
Create an API Key
The first step for integrating Privy is to obtain a client-side API key.
Navigate to the "Integrate" section on the left navigation bar, and ensure you're on the "API Keys" tab.
Within the Client-side keys section, click the "Create new key" button in the top right.
On the authorized origins section, enter http://localhost:3000
and click "Add origin".
Next, check the scopes labeled wallets.create
, wallets.read
, users.create
.
Check the "JWT Auth" box.
Finally, create your key and save it for subsequent steps.
Configure Privy for your API Key
After the key is generated, you need to set it to accept Privy auth tokens for authorization.
When you’re ready to move to production/mainnet with Privy, you will need to complete the “Upgrade to production” steps in the Privy dashboard (Settings > Basic > Application state).
Install Required Dependencies
Install the Crossmint React UI SDK and shadcn UI components:
Then, set up shadcn UI components:
Install the button and card components:
Configure Environment Variables
Add your Crossmint client-side API key and Privy App ID to your environment file:
Create the Provider Components
First, create a CrossmintPrivyProvider component that will wrap your application:
Now create a custom hook that connects Privy with Crossmint:
Update Your Layout
Update your app’s layout to use the CrossmintPrivyProvider:
Create UI Components
Create a component that uses the Privy connector and displays wallet information:
Create Your Main Page
Create your main page that uses the WalletCard component:
Launch and Test
The integration between Privy and Crossmint involves these key components:
Wallet Integration Flow:
Wallet Creation:
usePrivyConnector
hook finds the Privy walletKey Benefits:
Understanding Wallet Relationships
Handling JWT Authentication
The integration relies on JWT tokens for secure authentication:
useCrossmint
hookBest Practices
For more information on working with Crossmint Smart Wallets, check out these resources:
Send native tokens between wallets.
Send ERC20 and other tokens.
Check wallet balances.
Get NFTs owned by a wallet.