Overview
Provide users the ability to log into your app via Farcaster. This login method allows Farcaster users to login with their account and create a Magic wallet associated to their digital Farcaster Identifier (FID). Developers can access Farcaster user information such asfid
and username
, along with Magic metadata.

Compatibility
Farcaster Login is only available as of
[email protected]
.Use Cases
- Authenticate and create wallets for end users by prompting users to login via Farcaster native app.
Usage
You can implement Farcaster Login by including the Farcaster extension to your Magic instance. Once you’ve created a Magic client-side instance with the extension, log users in by callingmagicClient.farcaster.login()
. You can pass a showUI
parameter boolean indicating whether or not to show a pre-built modal interface displaying the QR code to the user. When false
, you can implement a custom UI to continue the Farcaster login.
Once logged in, you can retrieve the user’s Magic wallet address using getInfo
for Web/React Native.
Login
Farcaster Login works as an extension to Magic SDK. To add Farcaster Login to your Magic integration, start by installing the Farcaster Extension:Initialization
When creating your Magic instance, you’ll need to add an instance ofFarcasterExtension
to the Magic constructor:
JavaScript
Arguments
showUI?
(Boolean): Iftrue
, show an out-of-the-box UI to display the QR code to the user. Defaults totrue
.
Returns
PromiEvent<string | null>
: The promise resolves upon authentication request success and rejects with a specific error code if the request fails. The resolved value is a Decentralized ID token with a default 15-minute lifespan.
Example
JavaScript
Event Handling
A white-label Farcaster Login flow is available when passingshowUI: false
to this login method. Here’s a short example to illustrate listening for and emitting events during the login flow:
JavaScript