Skip to main content

Compatibility

The Wallet Kit widget requires React 18+ and is available for web applications using the JavaScript SDK.

Use Cases

  • Add a complete login UI to your React app without building custom components
  • Support multiple authentication methods (email OTP, OAuth, Farcaster, external wallets) from a single widget

Getting Started

Installation

Usage

Initialize Magic with the WalletKitExtension, then render the MagicWidget component in your app.
JavaScript

Configuration

The widget displays login options based on two sources: Dashboard-configured options — Email OTP and OAuth providers (Google, Apple, GitHub, etc.) are configured in your Magic Dashboard. Enable the authentication methods you want, and they will automatically appear in the widget. Code-configured options — External wallets and Farcaster are configured via props. Pass wallets to specify which external wallets to display, and enableFarcaster to show a Farcaster login button. For example, if you enable Email and Google OAuth in your dashboard and pass wallets={['metamask']} and enableFarcaster, the widget will show all four options: email input, Google sign-in button, Farcaster, and MetaMask.

Farcaster

To enable Farcaster login, pass the enableFarcaster prop. This adds a Farcaster button alongside your OAuth social providers. When clicked, users see a QR code they can scan with the Warpcast app on their phone. On mobile devices, the widget automatically redirects to the Farcaster app.
JavaScript

WalletConnect

If you include 'walletconnect' in the wallets prop, the widget uses Reown (formerly WalletConnect) under the hood. A default project ID is included for development, but for production apps you should provide your own to avoid rate limiting:
JavaScript
You can get a project ID by creating a free account at dashboard.walletconnect.com.

Account Switching

When a user switches to a different account in their wallet (e.g. MetaMask), the widget automatically re-runs SIWE authentication for the new account in the background. The user will see their wallet’s native signing prompt — no widget UI changes occur. Use onAccountChanged to respond when the new session is ready:
JavaScript

API Reference

Props

Login Results

The onSuccess callback receives a result object with a method property indicating the authentication type:
For email and Farcaster logins, use result.didToken for backend verification. For OAuth logins, use result.magic.idToken. Farcaster logins also include the user’s Farcaster profile data in result.farcaster.

Examples

Use modal mode to display the widget as an overlay:
JavaScript

Loading State

The widget fetches configuration from your Magic dashboard before rendering. During this time, it returns null. To show a loading indicator, render the widget with isOpen={false} and wait for onReady:
JavaScript
Create the Magic instance outside your component or use useMemo to prevent recreating it on every render.

Theming

The widget automatically applies your Magic dashboard theme settings including colors and light/dark mode. Configure these in your Magic Dashboard.

Resources