Email Collection
Email Collection
Magic offers out-of-the-box UI to request user information inline with OpenID standards. Currently, the only supported field is email
but in the future will support more profile information.
#Use Cases
- Request users that have signed in through any of the authentication methods for an email address.
#Usage
After following the quickstart to ensure Magic SDK is setup correctly and the user has succcesfully logged in, you can then request consent to collect their information as follows:
01import Web3 from 'web3';
02import { Magic } from 'magic-sdk';
03
04const magic = new Magic('YOUR_API_KEY', {
05 network: "goerli", // Ethereum testnet
06});
07const web3 = new Web3(magic.rpcProvider);
08
09// hook up to a login/signup button and replace it with the account address.
10const accounts = await magic.wallet.connectWithUI();
11const email = await magic.wallet.requestUserInfoWithUI({ scope: { email: "required" }});
#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.
- Refer to the 'Quickstart' for more options on network, web3 providers, and more.