@@ -5,4 +5,130 @@ description: "Group Connections | Documentation - Web3Auth"
55image : " images/docs-meta-cards/documentation-card.png"
66---
77
8- { /* TODO: Add Group Connections Steps */ }
8+ import AuthenticationGroupConnectionsSelect from " @site/static/images/dashboard/authentication-group-connections-select.png" ;
9+ import AuthenticationGroupConnectionsCreate from " @site/static/images/dashboard/authentication-group-connections-create.png" ;
10+ import AuthenticationGroupConnectionsConfirm from " @site/static/images/dashboard/authentication-group-connections-confirm.png" ;
11+
12+ Group Connections enable multiple login methods to be linked to the same on-chain user identity.
13+ This means that users logging in with different authentication providers (e.g., ** _ Google and Email
14+ Passwordless_ ** ) can still access the same wallet address—ensuring a unified user experience.
15+
16+ > _ Before setting up a group connection, developers must first configure individual login
17+ > connections that are eligible._
18+
19+ :::success Create Group Connection on Dashboard
20+
21+ To use this feature, developers must go to the ` Group Connections ` tab in the
22+ [ Web3Auth Dashboard] ( https://dashboard.web3auth.io ) .
23+
24+ <div style = { { flexBasis: " 300px" , flexGrow: " 1" , textAlign: " center" }} >
25+ <img
26+ src = { AuthenticationGroupConnectionsCreate }
27+ style = { { alignSelf: " center" , maxWidth: " 100%" }}
28+ alt = " Authentication Group Connections"
29+ />
30+ </div >
31+
32+ :::
33+
34+ ## Set Up a Group Connection
35+
36+ Follow these steps:
37+
38+ 1 . Visit the [ Web3Auth Dashboard] ( https://dashboard.web3auth.io ) .
39+ 2 . Go to the ` Group Connections ` section.
40+ 3 . Click on the ` Create Group ` button.
41+ 4 . Enter your custom ` Group Name ` .
42+ 5 . Select ` 1st social connection ` and ` 2nd social connection ` .
43+ 6 . Click ` Create Group ` .
44+
45+ <div style = { { flexBasis: " 300px" , flexGrow: " 1" , textAlign: " center" }} >
46+ <img
47+ src = { AuthenticationGroupConnectionsSelect }
48+ style = { { alignSelf: " center" , maxWidth: " 100%" }}
49+ alt = " Authentication Group Connections"
50+ />
51+ </div >
52+
53+ <div style = { { flexBasis: " 300px" , flexGrow: " 1" , textAlign: " center" }} >
54+ <img
55+ src = { AuthenticationGroupConnectionsConfirm }
56+ style = { { alignSelf: " center" , maxWidth: " 100%" }}
57+ alt = " Authentication Group Connections Confirm"
58+ />
59+ </div >
60+
61+ ## Usage
62+
63+ ### Initialize Web3Auth in Your App
64+
65+ Wrap your app with the ` Web3AuthProvider ` . This provider should be as close to the root of your
66+ React tree as possible.
67+
68+ ``` js title="Example: React + Vite (main.tsx)"
69+ import { StrictMode } from " react" ;
70+ import { createRoot } from " react-dom/client" ;
71+ import " ./index.css" ;
72+
73+ import { Web3AuthProvider , WEB3AUTH_NETWORK } from " @web3auth/modal/react" ;
74+
75+ import App from " ./App.tsx" ;
76+
77+ createRoot (document .getElementById (" root" )! ).render (
78+ < StrictMode>
79+ < Web3AuthProvider
80+ config= {{
81+ web3AuthOptions: {
82+ clientId: " your-client-id" , // Replace with your Client ID
83+ web3AuthNetwork: WEB3AUTH_NETWORK .SAPPHIRE_DEVNET ,
84+ },
85+ }}
86+ >
87+ < App / >
88+ < / Web3AuthProvider>
89+ < / StrictMode>
90+ );
91+ ```
92+
93+ Since, the ` Group Connections ` details are available from Dashboard, developers don't need to pass
94+ any additional parameters to the ` Web3AuthProvider ` .
95+
96+ > Follow our [ Quickstart Guide] ( /quick-start ) to setup the basic flow.
97+
98+ ### Login with Google
99+
100+ ``` jsx
101+ import { useWeb3AuthConnect , WALLET_CONNECTORS , AUTH_CONNECTION } from " @web3auth/modal/react" ;
102+
103+ const { connectTo } = useWeb3AuthConnect ();
104+
105+ const loginWithGoogle = async () => {
106+ await connectTo (WALLET_CONNECTORS .AUTH , {
107+ groupedAuthConnectionId: " group-connection-id" ,
108+ authConnectionId: " google-auth-connection-id" ,
109+ authConnection: AUTH_CONNECTION .GOOGLE ,
110+ });
111+ };
112+
113+ // Example: Login with Google
114+ < button onClick= {() => loginWithGoogle ()}> Login with Google< / button> ;
115+ ```
116+
117+ ### Login with Email Passwordless
118+
119+ ``` jsx
120+ import { useWeb3AuthConnect , WALLET_CONNECTORS , AUTH_CONNECTION } from " @web3auth/modal/react" ;
121+
122+ const { connectTo } = useWeb3AuthConnect ();
123+
124+ const loginWithEmailPasswordless = async () => {
125+ await connectTo (WALLET_CONNECTORS .AUTH , {
126+ groupedAuthConnectionId: " group-connection-id" ,
127+ authConnectionId: " email-passwordless-auth-connection-id" ,
128+ authConnection: AUTH_CONNECTION .EMAIL_PASSWORDLESS ,
129+ });
130+ };
131+
132+ // Example: Login with Email Passwordless
133+ < button onClick= {() => loginWithEmailPasswordless ()}> Login with Email Passwordless< / button> ;
134+ ```
0 commit comments