Skip to main content

Group connections

Group connections link multiple login methods to the same onchain user identity. Users who sign in with different authentication providers (for example, Google and email passwordless) access the same wallet address.

note

Configure the individual login connections you want to group before creating a group connection.

Set up a group connection

tip

Use the Group Connections tab in the MetaMask Developer Dashboard to create group connections.

  1. Go to the MetaMask Developer Dashboard.
  2. Select your project and go to the Group Connections section.
  3. Click Create Group.
  4. Enter a group name.
  5. Select the first and second social connections to include.
  6. Click Create Group.

Usage

Group connection details are pulled from the dashboard automatically. You don't need to pass any additional parameters to the Web3AuthProvider.

tip

Follow our quickstart to set up the basic flow.

web3authContext.tsx
import { WALLET_CONNECTORS, WEB3AUTH_NETWORK } from '@web3auth/modal'
import { type Web3AuthContextConfig } from '@web3auth/modal/react'

const web3AuthContextConfig: Web3AuthContextConfig = {
web3AuthOptions: {
clientId: 'YOUR_WEB3AUTH_CLIENT_ID', // Pass your Web3Auth Client ID, ideally using an environment variable
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
modalConfig: {
connectors: {
[WALLET_CONNECTORS.AUTH]: {
label: 'auth',
loginMethods: {
google: {
name: 'google login',
authConnectionId: 'w3a-google',
groupedAuthConnectionId: 'aggregate-sapphire',
},
facebook: {
name: 'facebook login',
authConnectionId: 'w3a-facebook',
groupedAuthConnectionId: 'aggregate-sapphire',
},
email_passwordless: {
name: 'email passwordless login',
authConnectionId: 'w3a-email-passwordless',
groupedAuthConnectionId: 'aggregate-sapphire',
},
},
},
},
},
},
}

export default web3AuthContextConfig