Biconomy SDK
Search…
⌃K

Enable Social Login For Users

Social Login is pluggable auth infrastructure built on Web3Auth for dApp developers who want to want to integrate social login without much hassle. Developers don't have to create client or go to any dashboard to whitelist urls.

Steps To Enable Social Login

  • Import the @biconomy/web3-auth package in your project.
import SocialLogin from "@biconomy/web3-auth";
  • Initialise the project
// init wallet
const socialLoginSDK = new SocialLogin();
await socialLoginSDK.init('0x5'); // Enter the network id in init() parameter
socialLoginSDK.showConnectModal();
// show connect modal
socialLoginSDK.showWallet();
  • Access to web3Auth provider after wallet connected
if (!socialLoginSDK?.web3auth?.provider) return;
const provder = new ethers.providers.Web3Provider(
socialLoginSDK.web3auth.provider,
);
const accounts = await provder.listAccounts();
console.log("EOA address", accounts)
  • Whitelisting your deployed domain via code
// get signature
const signature = const a = await socialLoginSDK.whitelistUrl('https://yourdomain.com');
// pass while initialization
const socialLoginSDK = await socialLoginSDK.init(ethers.utils.hexValue(5), {
'http://localhost:3001': signature
});
  • Once user clicks login, this is the modal that will be presented

Code Examples