Worldcoin Mini App SIWE with Privy
Privy offers a seamless integration with Worldcoin Mini Apps. This guide will walk you through integrating Sign-In With Ethereum (SIWE) using Privy in a Worldcoin Mini App. With this setup, you can offer secure wallet authentication for your users—combining the power of World App’s native wallet with Privy’s flexible authentication and wallet infrastructure.
Resources
Worldcoin Mini Apps Docs
Official documentation for building Worldcoin Mini Apps.
Worldcoin Developer Portal
Register your mini app and manage API keys.
Privy React Setup
Learn how to set up Privy in your React app.
Configure your Worldcoin developer portal
Create a Worldcoin developer account and mini app, learn more here.
Get set up with Privy
If you haven’t set up Privy yet, follow our React quickstart guide to get your app ID and configure your app.
Privy’s React Auth SDK provides a secure way to authenticate users and manage wallets in your frontend application. Learn more about getting started with React Auth.
Set up with Worldcoin Mini App
Create your mini app using the quickstart
Scaffold a new Worldcoin Mini App using the official template:
Follow the prompts in the README to set up your app. Use the env variables from your Worldcoin developer portal to configure your app.
Explore the starter repo structure
Your new app will have a file at src/components/AuthButton/index.tsx
—this is where you’ll add
Privy SIWE support.
SIWE into mini app with Privy
We will be using the useLoginWithSiwe
hook to handle the SIWE flow.
Get the nonce from Privy
Use the generateSiweNonce
function from Privy to get a unique nonce for the SIWE flow.
This nonce will be used to ensure the SIWE message is unique and secure.
Pass the nonce to Worldcoin walletAuth
Use the Worldcoin MiniKit to trigger the wallet authentication flow, passing in the nonce you just received.
This will prompt the user to sign a SIWE message in their World App wallet.
Send the signed message and signature to Privy
Take the response from Worldcoin (the signed message and signature) and send it to Privy to complete authentication.
This will log the user in via Privy using the SIWE flow.
Access the user session data
Once logged in, you can access the user’s worldcoin information and wallet data. For example, to get user info from Worldcoin:
Your Worldcoin Mini App now supports SIWE authentication with Privy and World App! Enjoy seamless, secure onboarding for your users 🚀