Skip to content

Commit 3ed2061

Browse files
committed
nit group connection page
1 parent 99c74f9 commit 3ed2061

File tree

1 file changed

+51
-27
lines changed

1 file changed

+51
-27
lines changed

docs/authentication/group-connections.mdx

Lines changed: 51 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import AuthenticationGroupConnectionsConfirm from "@site/static/images/dashboard
1111

1212
Group Connections enable multiple login methods to be linked to the same on-chain user identity.
1313
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.
14+
Passwordless_**) can still access the **same wallet address**—ensuring a unified user experience.
1515

1616
> _Before setting up a group connection, developers must first configure individual login
1717
> connections that are eligible._
@@ -99,36 +99,60 @@ any additional parameters to the `Web3AuthProvider`.
9999

100100
```jsx
101101
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>;
102+
import { useAccount } from "wagmi";
103+
104+
function LoginPage() {
105+
const { connectTo } = useWeb3AuthConnect();
106+
const { address } = useAccount();
107+
108+
const loginWithGoogle = async () => {
109+
await connectTo(WALLET_CONNECTORS.AUTH, {
110+
// highlight-start
111+
groupedAuthConnectionId: "group-connection-id",
112+
authConnectionId: "google-auth-connection-id",
113+
authConnection: AUTH_CONNECTION.GOOGLE,
114+
// highlight-end
115+
});
116+
};
117+
118+
return (
119+
<div>
120+
<button onClick={() => loginWithGoogle()}>Login with Google</button>
121+
<p>Address: {address}</p>
122+
{/* 0xeaA8Af602b2eDE45922818AE5f9f7FdE50cFa1A8 */}
123+
</div>
124+
);
125+
}
115126
```
116127

117128
### Login with Email Passwordless
118129

119130
```jsx
120131
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>;
132+
import { useAccount } from "wagmi";
133+
134+
function LoginPage() {
135+
const { connectTo } = useWeb3AuthConnect();
136+
const { address } = useAccount();
137+
138+
const loginWithEmailPasswordless = async () => {
139+
await connectTo(WALLET_CONNECTORS.AUTH, {
140+
// highlight-start
141+
groupedAuthConnectionId: "group-connection-id",
142+
authConnectionId: "email-passwordless-auth-connection-id",
143+
authConnection: AUTH_CONNECTION.EMAIL_PASSWORDLESS,
144+
});
145+
};
146+
147+
return (
148+
<div>
149+
<button onClick={() => loginWithEmailPasswordless()}>Login with Email Passwordless</button>
150+
<p>Address: {address}</p>
151+
{/* highlight-start */}
152+
{/* User's address remains same as above */}
153+
{/* 0xeaA8Af602b2eDE45922818AE5f9f7FdE50cFa1A8 */}
154+
{/* highlight-end */}
155+
</div>
156+
);
157+
}
134158
```

0 commit comments

Comments
 (0)