Privy
Privy provides comprehensive social login authentication for web3 applications, enabling users to create embedded wallets through familiar social platforms.
Supported social providers
Privy supports authentication through many popular social platforms:
- Apple
- Discord
- Farcaster
- GitHub
- Telegram
- TikTok
- X
For X, Privy supports both OAuth 2.0 and OAuth 1.0a authentication flows, providing flexibility based on your application's needs.
How social login works
When users choose social authentication, Privy handles the complete OAuth flow:
- Provider selection: Users select their preferred social platform
- OAuth redirect: Secure redirect to the chosen social provider's authentication page
- Permission approval: Users approve access permissions on the familiar social platform
- Account creation: Privy creates a user profile linked to their social account
- Wallet generation: An embedded wallet is automatically created for web3 interactions
- Token management: Optional OAuth tokens returned for additional API access
Setup and configuration
1. Enable social providers
Configure social authentication in the Privy Dashboard:
- Find the "User management" section in the dashboard sidebar
- Click on "Authentication"
- Navigate to the "Socials" tab
- Toggle on any desired social platforms.
2. OAuth credential options
Next to each social provider, you can see a dropdown that enables you to access OAuth configuration. Privy offers two approaches for OAuth configuration:
- Default credentials: Use Privy's pre-configured OAuth credentials for quick setup and testing. This is perfect for development and getting started quickly.
- Custom credentials: Configure your own OAuth applications for production use. This provides better security, branding control, and eliminates shared rate limits.
See the Privy guide to learn how to set up OAuth credentials with each provider.
Benefits of custom credentials:
- Your app branding appears on social login screens
- Better security and application control
- Dedicated rate limits for your application
- Enhanced resiliency and reliability
3. SDK integration
With configuration done, you can implement the Privy SDK and widget into your dapp.
First, install the Privy SDK:
npm install @privy-io/react-auth
There are many SDK flavours, depending on which language you're using.
Now wrap your app in the PrivyProvider
:
import { PrivyProvider } from '@privy-io/react-auth';
export default function App() {
return (
<PrivyProvider
appId="your-privy-app-id"
config={{
// Configure which login methods to show
loginMethods: ['email', 'wallet', 'google', 'twitter', 'discord'],
// Customize the authentication experience
appearance: {
theme: 'light',
accentColor: '#676FFF',
},
}}
>
{/* Your app components */}
</PrivyProvider>
);
}
Resources
- Visit the Privy Dashboard to configure social authentication
- Review OAuth provider setup guides for platform-specific configuration
- Explore embedded wallets for seamless web3 integration
- Check out the Privy documentation for advanced configuration options