Resources
Lens Docs
Official documentation for Lens protocol and SDK.
Privy Wagmi integration
Configure Privy with wagmi for EVM integrations.
Integrate Lens login
1
1. Install dependencies
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 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.
LensProvider
to use the Lens SDK across your app.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.You can customize whether to automatically create an embedded wallet for the user. See the
automatic wallet creation guide.
4
4. Fetch accounts for the connected wallet
First, fetch all the Lens accounts associated with the connected user wallet.
Switching wallets (if the user has more than one wallet)
Switching wallets (if the user has more than one wallet)
If a user has multiple wallets connected, set the active wallet to ensure you log in with the
correct Lens account.
5
5. Implement login with Lens
Create a hook that handles the Lens login process for the selected account.
6
6. Render accounts and trigger login
Show the fetched accounts and let users pick one to log in.
7
7. Check authentication status
Use
useAuthenticatedUser
to check whether the user is authenticated with a Lens account.Next steps
Explore the full Lens SDK documentation.- Create posts and publications
- React to publications
- Manage profiles and metadata