linkProfileWithRedirect

Links a new profile to the current user using OAuth redirect flow.

This function initiates a redirect-based OAuth flow for linking a social account. After the user completes authentication with the provider, they will be redirected back to your app. The autoConnect function will automatically detect the linking flow and complete the profile linking.

Example

import { linkProfileWithRedirect } from "thirdweb/wallets/in-app";
await linkProfileWithRedirect({
client,
strategy: "google",
mode: "redirect",
redirectUrl: "https://example.org/callback",
});
// Browser will redirect to Google for authentication
// After auth, user is redirected back and autoConnect handles the linking
function linkProfileWithRedirect(
args: Omit<SocialAuthArgsType, "mode"> & {
client: ThirdwebClient;
ecosystem?: Ecosystem;
mode?: "redirect" | "window";
},
): Promise<void>;

Parameters

The authentication arguments including strategy, client, and optional redirectUrl.

Type

let args: Omit<SocialAuthArgsType, "mode"> & {
client: ThirdwebClient;
ecosystem?: Ecosystem;
mode?: "redirect" | "window";
};

Returns

let returnType: Promise<void>;

A promise that resolves when the redirect is initiated.