Linking Multiple Identities

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


OAuth Authentication (Discord, Google, Apple, etc.)

import { linkProfile } from "thirdweb/wallets";
// optionally specify the ecosystem if you're linking an ecosystem wallet
await linkProfile({ client, strategy: "discord" });

OTP Authentication (Email, Phone)

import { linkProfile, preAuthenticate } from "thirdweb/wallets";
// For email OTP
const sendEmail = async () => {
await preAuthenticate({
client,
strategy: "email",
email: "john.doe@example.com",
});
};
// Then link with verification code
await linkProfile({
client,
strategy: "email",
email: "john.doe@example.com",
verificationCode: "123456",
});

Retrieve Linked Profiles

Once linked, you can retrieve the user profiles via either identity.

import { getProfiles } from "thirdweb/wallets";
const profiles = await getProfiles({
client,
// optionally sepcify the ecosystem for ecosystem wallets
});
console.log(profiles[0].type); // will be "email", "phone", "google", "discord", etc
console.log(profiles[0].details.email);
console.log(profiles[0].details.phone);

For fetching linked profile information from the backend, see Fetch Users.