Use this file to discover all available pages before exploring further.
Lens Protocol is an open social network that allows users to own their content and connections. Developers can build on the network, leveraging its audience and infrastructure. Users can seamlessly switch between social apps without losing their profiles, content, or connections.Allowing users to log into Lens with Privy is fully supported and simple to integrate.In this recipe, you’ll integrate Privy + wagmi with the Lens React SDK, then let users log in with their Lens account using an embedded or external wallet.
We use @lens-protocol/react@canary to access the latest Lens features.
2
2. Set up providers
This step assumes you have set up your project with Privy and integrated with wagmi. If not, follow the Privy wagmi guide.
Once your Privy setup is complete, initialize the Lens provider and client.Lens Protocol runs on the Lens chain (mainnet and testnet). Ensure your wagmi and Privy configs include the Lens chains.Wrap your app with LensProvider to use the Lens SDK across your app.
import {createConfig} from '@privy-io/wagmi';import {http} from 'wagmi';import {lens, lensTestnet} from 'viem/chains';export const wagmiConfig = createConfig({ chains: [lens, lensTestnet], transports: { [lens.id]: http(), [lensTestnet.id]: http() }});
You’ve successfully set up the Lens SDK. Your app is now ready to use features like logging in with Lens and posting directly on Lens.
3
3. Connect a wallet with Privy
Use login to prompt the user to connect a wallet. With Privy, you can automatically create wallets for users who don’t have one (for example, when signing in with Google or another social method). With this new wallet, you can onboard the user to your Lens‑powered app and keep the onboarding experience seamless.