Skip to content

Commit 0abb2aa

Browse files
committed
Update READMEs
1 parent 01839b0 commit 0abb2aa

13 files changed

Lines changed: 966 additions & 596 deletions

File tree

README.md

Lines changed: 66 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,66 @@
1-
# Web3Auth Mobile SDK Examples
2-
3-
[Web3Auth](https://web3auth.io) is a pluggable auth infrastructure for Web3 wallets and applications. This repository contains examples demonstrating the integration of Web3Auth's plug-and-play SDKs across various mobile platforms.
4-
5-
## 🌟 Key Features
6-
7-
- **Plug-and-Play Integration**: Ready-to-use SDKs for iOS, Android, React Native, and Flutter
8-
- **Social Logins**: Support for multiple authentication providers (Google, Facebook, Twitter, etc.)
9-
- **Blockchain Support**: Examples for various blockchain integrations (EVM, Solana, etc.)
10-
- **Custom Authentication**: Examples showing custom auth provider integration
11-
- **Aggregate Verifiers**: Advanced examples demonstrating multi-provider authentication
12-
13-
## 📱 Platform Examples
14-
15-
### React Native
16-
- [Quick Start Example](./react-native/rn-bare-quick-start): Basic integration with EVM chains
17-
- [Auth0 Example](./react-native/rn-bare-auth0-example): Custom authentication with Auth0
18-
- [Firebase Example](./react-native/rn-bare-firebase-example): Integration with Firebase authentication
19-
- [Solana Example](./react-native/rn-bare-solana-example): Integration with Solana blockchain
20-
- [Aggregate Verifier Example](./react-native/rn-bare-aggregate-verifier-example): Multi-provider authentication
21-
- [Expo Example](./react-native/rn-expo-example): Integration in Expo framework
22-
23-
### iOS
24-
- [Quick Start Example](./ios/ios-quick-start): Basic integration with EVM chains
25-
- [Auth0 Example](./ios/ios-auth0-example): Custom authentication with Auth0
26-
- [Firebase Example](./ios/ios-firebase-example): Integration with Firebase authentication
27-
- [Solana Example](./ios/ios-solana-example): Integration with Solana blockchain
28-
- [Aptos Example](./ios/ios-aptos-example): Integration with Aptos blockchain
29-
- [Aggregate Verifier Example](./ios/ios-aggregate-verifier-example): Multi-provider authentication
30-
- [Playground](./ios/ios-playground): Advanced features and configurations
31-
32-
### Flutter
33-
- [Quick Start Example](./flutter/flutter-quick-start): Basic integration with EVM chains
34-
- [Auth0 Example](./flutter/flutter-auth0-example): Custom authentication with Auth0
35-
- [Firebase Example](./flutter/flutter-firebase-example): Integration with Firebase authentication
36-
- [Aggregate Verifier Example](./flutter/flutter-aggregate-verifier-example): Multi-provider authentication
37-
38-
### Android
39-
- [Quick Start Example](./android/android-quick-start): Basic integration with EVM chains
40-
- [Auth0 Example](./android/android-auth0-example): Custom authentication with Auth0
41-
- [Firebase Example](./android/android-firebase-example): Integration with Firebase authentication
42-
- [Aggregate Verifier Example](./android/android-aggregate-verifier-example): Multi-provider authentication
43-
44-
## 🚀 Getting Started
45-
46-
Each example contains its own README with specific setup instructions. Generally, you'll need to:
47-
48-
1. Clone this repository
49-
2. Choose your platform and example
50-
3. Follow the example-specific README instructions
51-
4. Get your Web3Auth Client ID from the [Web3Auth Dashboard](https://dashboard.web3auth.io)
52-
5. Configure the example with your Client ID and run it
53-
54-
## 📚 Documentation
55-
56-
- [Web3Auth Documentation](https://web3auth.io/docs)
57-
- [Integration Builder](https://web3auth.io/docs/integration-builder)
58-
- Platform-specific guides:
59-
- [iOS Guide](https://web3auth.io/docs/sdk/pnp/ios)
60-
- [Android Guide](https://web3auth.io/docs/sdk/pnp/android)
61-
- [React Native Guide](https://web3auth.io/docs/sdk/pnp/react-native)
62-
- [Flutter Guide](https://web3auth.io/docs/sdk/pnp/flutter)
63-
64-
## 🤝 Support
65-
66-
- [Join our Discord](https://discord.gg/web3auth)
67-
- [Visit our Website](https://web3auth.io)
68-
- [Follow us on Twitter](https://twitter.com/web3auth)
69-
- [Submit an Issue](https://github.com/Web3Auth/web3auth-mobile-examples/issues)
70-
71-
## 📄 License
72-
73-
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
1+
# MetaMask Embedded Wallets — React Native Examples
2+
3+
This repository contains React Native example apps for integrating [MetaMask Embedded Wallets](https://docs.metamask.io/embedded-wallets/) (formerly Web3Auth). Each example demonstrates a specific use case and is fully runnable on iOS and Android.
4+
5+
## What is MetaMask Embedded Wallets?
6+
7+
MetaMask Embedded Wallets (formerly Web3Auth Plug and Play) provides non-custodial social login wallets. Users authenticate with Google, Facebook, Auth0, Firebase, or any JWT provider — and get a deterministic, non-custodial wallet without ever managing a seed phrase.
8+
9+
- **No seed phrases** for users
10+
- **Social logins** (Google, Facebook, Discord, Apple, and more)
11+
- **Custom authentication** via Auth0, Firebase, or any JWT provider
12+
- **Built-in EVM and Solana providers** in the React Native SDK
13+
- **Cross-platform** — runs on iOS and Android
14+
15+
## Examples
16+
17+
### React Native (Bare Workflow)
18+
19+
| Example | Description | Auth Method |
20+
|---|---|---|
21+
| [Quick Start](./rn-bare-quick-start) | Basic integration with Ethereum using social logins | Social (Google, email OTP) |
22+
| [Auth0 Example](./rn-bare-auth0-example) | Custom connection using Auth0 as the JWT provider | Custom (Auth0 JWT) |
23+
| [Firebase Example](./rn-bare-firebase-example) | Custom connection using Firebase Authentication | Custom (Firebase JWT) |
24+
| [Solana Example](./rn-bare-solana-example) | Solana chain integration with the built-in Solana provider | Social |
25+
| [Grouped Connections](./rn-bare-aggregate-verifier-example) | Link multiple auth methods so the same user gets the same wallet | Social (grouped) |
26+
27+
### React Native (Expo)
28+
29+
| Example | Description | Auth Method |
30+
|---|---|---|
31+
| [Expo Example](./rn-expo-example) | Basic integration using Expo managed workflow | Social (Google, email OTP) |
32+
33+
> **Note on SFA examples**: The `sfa-rn-bare-quick-start` and `sfa-rn-expo-auth0-example` folders use the deprecated Single Factor Auth (SFA) / Core Kit SDK. SFA has been superseded by the standard `@web3auth/react-native-sdk`. Refer to the active examples above for new integrations.
34+
35+
## Getting Started
36+
37+
1. Clone this repository:
38+
```bash
39+
git clone https://github.com/Web3Auth/web3auth-react-native-examples.git
40+
```
41+
2. Go to the example you want to run and follow its individual README.
42+
3. Get a Client ID from the [Web3Auth Dashboard](https://dashboard.web3auth.io).
43+
4. Configure the Client ID, redirect URL scheme, and any auth provider credentials in the example.
44+
5. Run on Android or iOS.
45+
46+
## Key Concepts
47+
48+
**Dashboard setup** — Every example requires a Client ID from [dashboard.web3auth.io](https://dashboard.web3auth.io). You must also allowlist your app's redirect URL scheme (e.g. `web3authrnexample://auth`) in the dashboard under your project's **Allowed Origins**.
49+
50+
**Sapphire networks** — Use `WEB3AUTH_NETWORK.SAPPHIRE_DEVNET` during development (allows localhost), and switch to `WEB3AUTH_NETWORK.SAPPHIRE_MAINNET` for production. Do not mix them — different networks derive different wallet addresses.
51+
52+
**Connections** — The dashboard term for authentication configurations (formerly called "verifiers"). Social logins come pre-configured. For custom auth (Auth0, Firebase, etc.), you create a Custom Connection on the dashboard.
53+
54+
**Polyfills** — React Native does not ship all Node.js built-ins. Each example includes a `metro.config.js` with the required polyfills (`crypto-browserify`, `readable-stream`, etc.) and a `globals.js` / `index.js` that imports them in the correct order before app code.
55+
56+
## Documentation & Resources
57+
58+
- [MetaMask Embedded Wallets Docs](https://docs.metamask.io/embedded-wallets/)
59+
- [React Native SDK Reference](https://docs.metamask.io/embedded-wallets/sdk/react-native/)
60+
- [Dashboard](https://dashboard.web3auth.io)
61+
- [Metro Polyfill Troubleshooting](https://docs.metamask.io/embedded-wallets/troubleshooting/metro-issues/)
62+
- [Community (Builder Hub)](https://builder.metamask.io/c/embedded-wallets/5)
63+
64+
## License
65+
66+
MIT — see [LICENSE](./LICENSE).
Lines changed: 125 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,159 @@
1-
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
1+
# MetaMask Embedded Wallets — React Native Grouped Connections Example
22

3-
# Getting Started
3+
A bare React Native example demonstrating **Grouped Connections** (formerly called Aggregate Verifiers) — a Web3Auth feature that links multiple authentication methods so the same user always gets the **same wallet address**, regardless of which login method they use.
44

5-
>**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
5+
## What this example demonstrates
66

7-
## Step 1: Start the Metro Server
7+
- Configuring a **Grouped Connection** on the Web3Auth Dashboard
8+
- Linking Google, email passwordless (Auth0), and GitHub (Auth0) under a single connection group
9+
- Using the shared `verifier` + `verifierSubIdentifier` pattern in `loginConfig`
10+
- Same Ethereum wallet regardless of which login method is used
811

9-
First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
12+
## Why Grouped Connections?
1013

11-
To start Metro, run the following command from the _root_ of your React Native project:
14+
Without grouping, a user who logs in with Google gets one wallet, and the same user logging in with their email gets a completely different wallet. Grouped Connections solve this by linking multiple sub-connections under a parent group connection, using a common identifier (such as `email`) to map users across providers.
1215

13-
```bash
14-
# using npm
15-
npm start
16+
**Example:** Google (uses `email` as identifier) + Auth0 Email Passwordless (uses `email`) → same wallet.
1617

17-
# OR using Yarn
18-
yarn start
19-
```
18+
## Tech stack
19+
20+
- React Native `0.74.x` (bare workflow)
21+
- `@web3auth/react-native-sdk` `^8.0.0`
22+
- `@web3auth/ethereum-provider` `^9.3.0`
23+
- `ethers` `^6.x`
24+
- `react-native-encrypted-storage`
25+
- `@toruslabs/react-native-web-browser`
26+
27+
## Prerequisites
28+
29+
- Node.js `>=18`
30+
- React Native development environment — [React Native CLI Quickstart](https://reactnative.dev/docs/environment-setup)
31+
- A [Web3Auth Dashboard](https://dashboard.web3auth.io) project
2032

21-
## Step 2: Start your Application
33+
## Dashboard Setup
2234

23-
Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
35+
### Create a Grouped Connection
2436

25-
### For Android
37+
1. Go to [dashboard.web3auth.io](https://dashboard.web3auth.io) and open your project.
38+
2. Under **Connections**, create a new **Grouped Connection**.
39+
3. Add **sub-connections** to the group (e.g. Google, Auth0 Email Passwordless, Auth0 GitHub).
40+
4. For each sub-connection, ensure the **user identifier field** maps to the same value across providers. For example:
41+
- Google: use `email` (must be pre-set in Google sub-connection config)
42+
- Auth0 Email Passwordless: use `email`
43+
- Auth0 GitHub: use `email` (Auth0 GitHub should include the user's email in the JWT)
44+
5. Note the **Grouped Connection ID** and each **sub-connection ID**.
45+
6. Under **Allowed Origins**, add:
46+
```
47+
web3authrnbareaggregateexample://auth
48+
```
49+
50+
## Installation
2651

2752
```bash
28-
# using npm
29-
npm run android
53+
git clone https://github.com/Web3Auth/web3auth-react-native-examples.git
54+
cd web3auth-react-native-examples/rn-bare-aggregate-verifier-example
55+
npm install
56+
```
3057

31-
# OR using Yarn
32-
yarn android
58+
### iOS
59+
60+
```bash
61+
cd ios && pod install && cd ..
3362
```
3463

35-
### For iOS
64+
## Configuration
65+
66+
In `App.tsx`, each login method references the parent grouped connection via `verifier` and its own sub-connection via `verifierSubIdentifier`:
67+
68+
```typescript
69+
const web3auth = new Web3Auth(WebBrowser, EncryptedStorage, {
70+
clientId: "YOUR_WEB3AUTH_CLIENT_ID",
71+
network: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
72+
redirectUrl: "web3authrnbareaggregateexample://auth",
73+
privateKeyProvider: ethereumPrivateKeyProvider,
74+
loginConfig: {
75+
google: {
76+
verifier: "YOUR_GROUPED_CONNECTION_ID", // parent group connection
77+
verifierSubIdentifier: "YOUR_GOOGLE_SUB_ID", // Google sub-connection ID
78+
typeOfLogin: "google",
79+
clientId: "YOUR_GOOGLE_OAUTH_CLIENT_ID",
80+
},
81+
auth0emailpasswordless: {
82+
verifier: "YOUR_GROUPED_CONNECTION_ID", // same parent group connection
83+
verifierSubIdentifier: "YOUR_A0_EMAIL_SUB_ID", // Auth0 email sub-connection ID
84+
typeOfLogin: "jwt",
85+
clientId: "YOUR_AUTH0_CLIENT_ID",
86+
jwtParameters: {
87+
domain: "https://YOUR_AUTH0_DOMAIN",
88+
verifierIdField: "email",
89+
isVerifierIdCaseSensitive: false,
90+
},
91+
},
92+
},
93+
});
94+
```
95+
96+
> **Important**: All sub-connections must use the same user identifier value. If Google and Auth0 both return `email`, the same email always resolves to the same wallet.
97+
98+
## Running the app
3699

37100
```bash
38-
# using npm
39-
npm run ios
101+
npm start # start Metro
102+
npm run ios # iOS
103+
npm run android # Android
104+
```
40105

41-
# OR using Yarn
42-
yarn ios
106+
## How it works
107+
108+
### Login with Google
109+
110+
```typescript
111+
await web3auth.login({ loginProvider: "google" });
43112
```
44113

45-
If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
114+
### Login with email OTP (Auth0)
115+
116+
```typescript
117+
await web3auth.login({
118+
loginProvider: "auth0emailpasswordless",
119+
extraLoginOptions: {
120+
login_hint: email,
121+
domain: "https://YOUR_AUTH0_DOMAIN",
122+
},
123+
});
124+
```
46125

47-
This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
126+
Both methods produce the **same wallet address** for the user with the same email.
48127

49-
## Step 3: Modifying your App
128+
## Key concepts
50129

51-
Now that you have successfully run the app, let's modify it.
130+
**Grouped Connection** — A parent connection on the Web3Auth Dashboard that aggregates multiple sub-connections. It uses Shamir Secret Sharing across the sub-connection shares to produce the same key regardless of which login method was used.
52131

53-
1. Open `App.tsx` in your text editor of choice and edit some lines.
54-
2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!
132+
**`verifier`** — Must be the Grouped Connection ID (the parent).
55133

56-
For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!
134+
**`verifierSubIdentifier`** — Must be the individual sub-connection ID within the group.
57135

58-
## Congratulations! :tada:
136+
**Identifier mapping** — The `verifierIdField` (e.g. `email`) must resolve to the **same value** across all sub-connections for a given user.
59137

60-
You've successfully run and modified your React Native App. :partying_face:
138+
## Troubleshooting
61139

62-
### Now what?
140+
**Different wallet addresses for different login methods**
141+
- Confirm all `verifier` fields use the exact same Grouped Connection ID.
142+
- Confirm the `verifierIdField` resolves to the same value (e.g. same email) across all providers.
63143

64-
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
65-
- If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
144+
**`Verifier not found`**
145+
- The `verifier` and `verifierSubIdentifier` must exactly match what is configured on the dashboard (case-sensitive).
66146

67-
# Troubleshooting
147+
**Metro polyfill errors**
148+
- See [Metro Polyfill Troubleshooting](https://docs.metamask.io/embedded-wallets/troubleshooting/metro-issues/).
68149

69-
If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
150+
## Resources
70151

71-
# Learn More
152+
- [MetaMask Embedded Wallets Docs](https://docs.metamask.io/embedded-wallets/)
153+
- [React Native SDK Reference](https://docs.metamask.io/embedded-wallets/sdk/react-native/)
154+
- [Dashboard](https://dashboard.web3auth.io)
155+
- [Community (Builder Hub)](https://builder.metamask.io/c/embedded-wallets/5)
72156

73-
To learn more about React Native, take a look at the following resources:
157+
## License
74158

75-
- [React Native Website](https://reactnative.dev) - learn more about React Native.
76-
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
77-
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
78-
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
79-
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
159+
MIT — see [LICENSE](../LICENSE).

0 commit comments

Comments
 (0)