Quickstart Get started with authentication UI elements and a wallet connector.
Openfort Kit is the easiest way to onboard your users onchain.
Themes
midnight soft retro minimal web95 rounded nouns Social login configuration Login with social login oauth providers (e.g. Google, X) will not work in this demo due to iframe cross-origin restrictions.
View live demo
Start by installing Openfort Kit and its peer dependencies using your package manager of choice:
npm yarn pnpm
_10 npm install @openfort/openfort-kit wagmi viem@^2.22.0 @tanstack/react-query
In the API keys section of Openfort dashboard , you will find:
Publishable Key : Safe to expose in client-side environment
Secret Key : Must be kept secure and used only server-side
To generate non-custodial wallets:
Scroll to the Shield section and click Create Shield keys
Store the encryption share safely when it appears (you'll only see it once)
You'll receive:
Shield Publishable Key : Safe for client-side use
Shield Secret Key : Keep secure, server-side only
You will also need a walletConnect project ID. You can get one by creating a project on the WalletConnect dashboard .
Set up providers for Wagmi, TanStack Query, and OpenfortKit.
To set up a config for Wagmi, we will use Wagmi's createConfig
function with @openfort/openfort-kit
's getDefaultConfig
function. This automatically sets up the Wagmi instance to support all chains and transports supported by Openfort. If you need more configuration go to the Wagmi configuration guide .
To set up OpenfortKitProvider
we will need the publishable key from the Openfort dashboard, and the wallet configuration. More information on the wallet configuration can be found here .
_49 import React from 'react'
_49 import { AuthProvider, OpenfortKitProvider, getDefaultConfig, RecoveryMethod } from '@openfort/openfort-kit';
_49 import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
_49 import { WagmiProvider, createConfig } from 'wagmi'
_49 import { polygonAmoy } from 'viem/chains'
_49 const config = createConfig(
_49 appName: 'OpenfortKit demo',
_49 walletConnectProjectId: "YOUR_WALLET_CONNECT_PROJECT_ID",
_49 chains: [polygonAmoy],
_49 ssr: true, // Enable server-side rendering if needed
_49 const queryClient = new QueryClient()
_49 export function Providers({ children }: { children: React.ReactNode }) {
_49 <WagmiProvider config={config}>
_49 <QueryClientProvider client={queryClient}>
_49 // Set the publishable key of your OpenfortKit account. This field is required.
_49 publishableKey={"YOUR_PUBLISHABLE_KEY"}
_49 // Set the wallet configuration. In this example, we will be using the embedded wallet.
_49 createEmbeddedSigner: true,
_49 embeddedSignerConfiguration: {
_49 shieldPublishableKey: "YOUR_SHIELD_PUBLISHABLE_KEY",
_49 // Set the recovery method you want to use, in this case we will use the password recovery method
_49 recoveryMethod: RecoveryMethod.PASSWORD,
_49 // With password recovery we can set the encryption key to encrypt the recovery data
_49 // This way we don't have a backend to store the recovery data
_49 shieldEncryptionKey: "YOUR_SHIELD_ENCRYPTION_SHARE"!,
_49 </OpenfortKitProvider>
_49 </QueryClientProvider>
Wrap your app in the Providers
component.
_10 import React from 'react'
_10 import { Providers } from './Providers'
_10 export default function App() {
_10 {/* Your app content */}
Once you've configured your app, you can now use OpenfortKitButton
to onboard your users.
_11 import { OpenfortKitButton } from '@openfort/openfort-kit';
_11 <OpenfortKitButton />
Now that you've set up Openfort Kit, you can explore more features and customization options: