Linking Multiple Profiles

In-App Wallets allow users to tie the same wallet address to multiple social profiles. Developers can programmatically link additional profiles at any point in their user journey.

import { inAppWallet, linkProfile } from "thirdweb/wallets";
const wallet = inAppWallet();
await wallet.connect({ strategy: "google" });
await linkProfile(wallet, { strategy: "discord" });

Both the Google and Discord accounts will now be linked to the same wallet.

If the Discord account is already linked to this or another wallet, this will throw an error.

You can retrieve all profiles linked to a wallet using the getProfiles method:

import { inAppWallet, getProfiles } from "thirdweb/wallets";
const wallet = inAppWallet();
wallet.connect({ strategy: "google" });
const profiles = getProfiles(wallet);

This will return an array of profiles:

[
{
type: "google",
details: {
},
},
{
type: "discord",
details: {
},
},
{
type: "wallet",
details: {
address: "0xeC...c4",
},
},
];

Retrieve Linked Profiles

You can use the useProfiles hook to fetch linked profiles for the current wallet.

import { useProfiles } from "thirdweb/react";
const { data: profiles } = useProfiles();
console.log("Type:", profiles[0].type); // "discord"
console.log("Email:", profiles[0].details.email); // "[email protected]"

Note that the email field above will differ based on the profile type. We list the expected field below in our list of strategies.

List of Strategies

StrategyTypedetails Field
Email"email"email
Phone"phone"phone
Passkey"passkey"id
Google"google"email
Discord"discord"email
Telegram"telegram"id
Farcaster"farcaster"id
Line"line"id
Apple"apple"email
Facebook"facebook"email
Wallet"wallet"address
JWT"jwt"id
Auth Endpoint"auth_endpoint"id