Docs

Allows users to connect to your app using Magic Auth or Magic Connect

Magic is a developer SDK that integrates with your application to enable passwordless Web3 onboarding (no seed phrases) and authentication using magic links

Example

Magic offers two flavors of our SDK: Magic Connect, which provides a plug-and-play experience, and Magic Auth, a customizable white-labeled wallet solution.

Magic Auth

Login with Email or Phone Number

With below configuration, users will be able to log in using their email or phone number.

If you want to restrict login via email only - pass smsLogin:false . If you want to restrict login via phone number only - pass emailLogin:false to the MagicLink constructor.

import { MagicLink } from "@thirdweb-dev/wallets";

const wallet = new MagicLink({
  apiKey: "YOUR_API_KEY",
  type: "auth",
});

// connect with email or phone number

await wallet.connect({
  email: "user@example.com",
});

// OR

await wallet.connect({
  phoneNumber: "+123456789",
});

Social Login

import { MagicLink } from "@thirdweb-dev/wallets";

const wallet = new MagicLink({
  apiKey: "YOUR_API_KEY",
  type: "auth",

  // specify which Oauth providers to enable
  // and the URI to redirect to after the oauth flow is complete
  oauthOptions: {
    redirectURI: "https://example.com/foobar",
    providers: ["google", "facebook"],
  },
});

// connect with a oauth provider
await magic.connect({
  oauthProvider: "google",
});

Magic Connect

import { MagicLink } from "@thirdweb-dev/wallets";

const wallet = new MagicLink({
  apiKey: "YOUR_API_KEY",
  type: "connect",
});

await wallet.connect();

Methods

Inherited Methods

Properties