This repository contains comprehensive Flutter examples demonstrating the integration of MetaMask Embedded Wallets (formerly Web3Auth Plug and Play) SDK. These examples showcase seamless authentication experiences with social logins, custom authentication, and blockchain interactions for both iOS and Android platforms.
- Social Authentication: Google, Facebook, Twitter, Discord, Apple, and more
- Custom Authentication: Firebase, Auth0, and JWT-based authentication
- Grouped Connections: Same wallet across multiple authentication methods
- Multi-Factor Authentication (MFA): Enhanced security options
- Blockchain Agnostic: Full support for EVM chains, Solana, and others
- Cross-Platform: Unified codebase for iOS and Android
- Non-Custodial: Fully decentralized key management using Shamir Secret Sharing
These examples use the latest MetaMask Embedded Wallets SDK (web3auth_flutter ^8.0.0):
| Example | Description | Features |
|---|---|---|
| flutter-quick-start | Basic integration with social logins | EVM chains, social authentication |
| flutter-firebase-example | Custom auth with Firebase | Firebase Auth, JWT verification |
| flutter-auth0-example | Custom auth with Auth0 | Auth0 integration, OAuth 2.0 |
| flutter-aggregate-verifier-example | Grouped connections | Same wallet across multiple providers |
| flutter-solana-example | Solana blockchain integration | Solana wallet, SPL tokens |
| flutter-playground | Advanced features showcase | MFA, wallet services, multi-chain |
All examples target web3auth_flutter ^8.0.0 (Auth v11, Wallet Services v6, Android native 11.0.0, iOS native Web3Auth 13 via Swift Package Manager).
- iOS deployment target is 15.0. Native Web3Auth is linked by the plugin's Swift package, not a CocoaPods
Web3Authpod. MFALevel.DEFAULTis removed. UseOPTIONAL,MANDATORY, orNONE.- Leave
sessionTimeunset so the SDK reads it from the dashboard. enableMFA()andmanageMFA()take no arguments.init()setssdkVersionand Flutter analytics. Do not set them in app code.- Quick start and playground call
getAccessToken()andrefreshSession()after login. - Custom JWT (Firebase) stays on the SFA path:
LoginParams(authConnection: AuthConnection.custom, authConnectionId: ..., idToken: ...).
- Flutter SDK 3.0.0 or higher
- Dart 2.18.0 or higher
- iOS: iOS 15+, Xcode 15+, Swift 5.x (Swift Package Manager resolves native Web3Auth)
- Android: API level 26+, compileSdkVersion 34
- MetaMask Embedded Wallets Dashboard account
-
Clone the repository:
git clone https://github.com/Web3Auth/web3auth-flutter-examples.git cd web3auth-flutter-examples -
Choose an example:
cd flutter-quick-start # or any other example
-
Install dependencies:
flutter pub get
-
iOS setup (if targeting iOS):
cd ios && pod install && cd ..
-
Configure your project:
- Create a project on the Embedded Wallets Dashboard
- Get your Client ID
- Choose network: Sapphire Devnet (for testing) or Sapphire Mainnet (for production)
- Configure allowlisted URLs and bundle IDs
- Update the Client ID in the example code
-
Run the app:
flutter run
- Sapphire Devnet: For development and testing (allows localhost)
- Sapphire Mainnet: For production (does NOT allow localhost)
- Social Logins: Pre-configured Google, Facebook, Discord, Twitter, Apple, etc.
- Custom Authentication: Bring your own JWT provider (Firebase, Auth0, AWS Cognito, etc.)
- Grouped Connections: Link multiple login methods to the same wallet address
- Uses Shamir Secret Sharing (SSS) for non-custodial key management
- Same user + same config = same wallet address (deterministic)
- Keys are reconstructed from distributed shares - no single party holds the full key
- Set
compileSdkVersion 34in your app'sbuild.gradle - Add JitPack repository to your project-level
build.gradle - Configure deep link intent filter in
AndroidManifest.xml - Add Internet permission to manifest
See individual example READMEs for detailed configuration.
- Set minimum iOS platform to 14.0 in
Podfile - Configure URL scheme in
Info.plist - Allowlist
{bundleId}://authin the dashboard - Handle URL scheme in app delegate
See individual example READMEs for detailed configuration.
Build errors: Update Flutter and dependencies with flutter upgrade and flutter pub upgrade
OAuth issues: Verify your dashboard configuration, allowlisted URLs, and bundle IDs
iOS deep linking: Check URL scheme configuration in Info.plist and dashboard allowlist
Android deep linking: Verify intent filter in AndroidManifest.xml and package name in dashboard
Network errors: Ensure you're using the correct Sapphire network (devnet for localhost testing)
For more help, check the troubleshooting docs or ask in our community.
We welcome contributions! Please feel free to submit issues and pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ by the Web3Auth team