Configuration
Configure Openfort Kit
In this guide, we will show you how to use the Openfort Kit configuration to customize the look and feel of the Openfort login screen, configure your signer and more.
To learn more about the provider configuration, go to the provider configuration page.
This is a full example of how to use the OpenfortKitProvider
with password authentication and a retro
theme, using beamTestnet
and polygonAmoy
chains.
_88import React from 'react';_88_88import { QueryClient, QueryClientProvider } from '@tanstack/react-query';_88import { AuthProvider, OpenfortKitProvider, RecoveryMethod, getDefaultConfig } from '@openfort/openfort-kit';_88import { beamTestnet, polygonAmoy } from 'viem/chains';_88import { WagmiProvider, createConfig } from 'wagmi';_88import CustomLogo from './CustomLogo';_88_88const config = createConfig(_88 getDefaultConfig({_88 appName: 'OpenfortKit Next.js demo',_88 chains: [beamTestnet, polygonAmoy],_88_88 walletConnectProjectId: process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID!,_88 })_88);_88_88const queryClient = new QueryClient();_88_88export const Web3Provider = ({ children }: { children: React.ReactNode }) => {_88 return (_88 <WagmiProvider config={config}>_88 <QueryClientProvider client={queryClient}>_88 <OpenfortKitProvider_88_88 // Set the publishable key of your OpenfortKit account. This field is required._88 publishableKey={process.env.NEXT_PUBLIC_OPENFORT_PUBLIC_KEY!}_88_88 // Set the wallet configuration. In this example, we will be using the embedded signer._88 walletConfig={{_88 createEmbeddedSigner: true,_88_88 embeddedSignerConfiguration: {_88 shieldPublishableKey: process.env.NEXT_PUBLIC_SHIELD_API_KEY!,_88_88 // Set the recovery method you want to use, in this case we will use the automatic recovery method_88 recoveryMethod: RecoveryMethod.AUTOMATIC,_88_88 // Set the encryption key endpoint to encrypt the recovery data_88 createEncryptedSessionEndpoint: '/api/protected-create-encrypted-session',_88_88 // You can set a policy id to sponsor the gas fees for your users_88 ethereumProviderPolicyId: process.env.NEXT_PUBLIC_POLICY_ID,_88 }_88 }}_88_88 // This is the callback that will be called when the user connects or disconnects_88 onConnect={(params) => {_88 console.log('onConnect', params);_88 }}_88 onDisconnect={() => {_88 console.log('onDisconnect');_88 }}_88_88 options={{_88 // You can customize the logo of your app_88 logo: (<CustomLogo />),_88_88 // Set the auth providers you want to use_88 authProviders: [_88 AuthProvider.GUEST,_88 AuthProvider.EMAIL,_88 AuthProvider.GOOGLE,_88 AuthProvider.TWITTER,_88 AuthProvider.FACEBOOK,_88 AuthProvider.WALLET,_88 ],_88_88 // Set the chain id you want to use, by default it will use the first chain_88 initialChainId: polygonAmoy.id,_88_88 // Skip the email verification, useful for testing_88 skipEmailVerification: true,_88_88 // Other useful options_88 overlayBlur: 2.5,_88 hideTooltips: true,_88 }}_88_88 // Set the theme of the OpenfortKit_88 theme="retro"_88 >_88 {children}_88 </OpenfortKitProvider>_88 </QueryClientProvider>_88 </WagmiProvider >_88 );_88};
OpenfortKitButton#
The button component that will allow your users to connect to Openfort.
To learn more about the OpenfortKitButton
component, go to the button configuration page.
_10import { OpenfortKitButton } from '@openfort/openfort-kit';_10_10function App() {_10 return (_10 <div>_10 <OpenfortKitButton />_10 </div>_10 );_10};