Email Collection

Email Collection

restricted availability

Universal wallets will soon be merged with Dedicated Wallets into a single product line. Universal apps created before February 7, 2024 will work as expected with no change. See our blog post to learn more.

#Overview

Magic offers out-of-the-box UI to request user information in line with OpenID standards. Currently, the only supported field is email but more profile information will be supported in the future.

#Compatibility

  • For Dedicated Wallet, emails are automatically collected
  • For Universal Wallet, must be manually integrated. Follow the documentation below to implement.
  • Email Collection is available via the following client-side SDKs:

#Use Cases

#Usage

Once you've completed the quickstart to verify the correct setup of the Magic SDK and the user is successfully authenticated and logged in, you can then request consent to collect their information:

Web3.js
Ethers (v6)
01import Web3 from 'web3';
02import { Magic } from 'magic-sdk';
03
04const magic = new Magic('YOUR_API_KEY', {
05  network: "goerli", // Ethereum testnet
06});
07
08// Do something with provider
09const web3 = new Web3(magic.rpcProvider);
10
11const accounts = await magic.wallet.connectWithUI();
12
13const email = await magic.user.requestInfoWithUI({ scope: { email: "required" }});
14
15console.log(email)

#Configuration

  • In order to collect emails from users that have authenticated through a third-party wallet, developers will need to be subscribed to the approriate pricing tier.

#Resources