Questions regarding Web3Auth

I’m using Web3auth as provider on my Moralis application, but I have some questions with it.

  1. Is there a way to get the chaindId used to login? Right now I’m using localStorage to store the chainId and user.ethAddress to get the address. With Metamask I can use Moralis.chainId, but with web3auth, after refresh, I get undefined.

  2. Is there a way to know what login method was used by the user: Metamask (option “Connect with Wallet” on Web3Auth modal), email or social media?

As per the docs, the default chain id is 0x1 unless the chainid is passed as a parameter for login.

I haven’t tried this but maybe you can query the _User class and check the authData column and see if there is a difference.

Hey guys, quick question.

Usually when the user accesses the web3 application with a web2 auth (email, Facebook, Twitter, or any other) means that he cannot do any transaction within the blockchain, right?

In this case, what would be the best approach in your opinion?
I have in mind this approach:
1- User connects with auth web2 method
2- The app hides the actions that interact with the blockchain


1- User connects with auth web2 method
2- The app does not hide the actions that interact with the blockchain but shows an alert with a message saying that the user needs to connect with a crypto wallet prior to doing that action.

Would you guys have a better approach?
Which one do you prefer?

A better approach here is considering authentication using Web3Auth, in this case, a user authenticates with (Google, Facebook, Twitter, or any other means ) and still be able to interact with the blockchain

I’m using web3Auth but I still don’t understand how the user will be able to interact with blockchain if he connected with something different than a crypto wallet. Would you be able to explain me that?

I meant interaction as transactions, let’s say a user wants to mint an item on the platform logged in with a web2 method (Google, Facebook, Twitter, or any other means ).

Behind the scene, when the user logs in with maybe google for example the user got an address reserved for the account such that if it logs in again, it’s still same address so the user is able to interact with the blockchain just like using metamask.

Got it, and how can he deposits money (bnb) and see its balance?
I’m just thinking about the user that doesn’t have any experience with blockchain logging in my platform and wanting to mint an NFT for example.

Once the user is authenticated, you can get the user’s address with LOGGEDIN_USER_OBJECT.get('ethAddress') and do other things the way it’s done using moralis. Here’s an example

I’m still confused regarding the way that the user would deposit money to his address for example.

Let’s say I’m a grandma that does not know anything about web3/blockchain.

I log in to an application but I only know the web2 authentication via email, after I’m logged in, how am I gonna mint my NFT since it needs cryptocurrency within my address and I have never used a crypto wallet?

Maybe you can then look into fiat on ramp in that case

1 Like

Awesome, I’m going to take a look at it.
Thanks, buddy!

Hey @qudusayo, sorry to bother you again man.

I did all configuration with web3auth, I was able to log in by Gmail and I also transferred some tokens to the address created.

Should I be able to mint an NFT just by being signed in with Gmail or Do I need something else to do the transaction with the smart contract?

That is all handled by the connected wallet (e.g. an external wallet connected to Web3Auth) when you go to sign a transaction for minting an NFT.

So you mean that the user cannot do any transactions within the blockchain if he does not have a crypto wallet installed and connected to it right?

What would be the objective of having a web2 method login when the user cannot do anything unless log in to the website?

I’m just trying to understand what is the best approach I should take since my clients are not tech-savvy.

Yes a wallet needs to be provided but Web3Auth creates one for users in addition to allowing external wallets (just gave that as an example, should have made that clearer).

Once the user logs in, Web3Auth provides a web3 provider to then sign any transactions.

I think I’m getting a better understanding of that. Thanks, Glad.

Would you be able to assist me with the loading of contracts using ethers.js and web3auth?
I’m trying here using signer but I’m still not able to do so.

export const start = async () => {

  try {

    let ethereum;

    ethereum = window.ethereum;

    if (!window.ethereum) return;

    if (!window.ethereum && window.web3) {

      ethereum = window.web3.currentProvider;



    await requestAccount();

    const provider = new ethers.providers.Web3Provider(

      window.Web3auth.provider ? window.Web3auth.provider : ethereum,



    console.log('provider: ', window.Web3auth.provider);



  } catch (e) {



const loadContracts = async (provider: any) => {

  let signer = provider.getSigner();

  console.log('provider: ', provider);

  console.log('signer: ', signer);


    return console.error('Error loading contracts.');


  let Contract: any = {};

  Contract.marketplace = new ethers.Contract(ITEM_MARKETPLACE_FACET_ADDRESS, itemMarketPlaceFacet, signer);

  Contract.item = new ethers.Contract(ITEM_FACET_ADDRESS, itemFacet, signer); = new ethers.Contract(ITEM_STORAGE_ADDRESS, itemStorage, signer);

  window.Provider = provider;

  window.Contract = Contract;


The signer is empty there and therefore giving me an error. @alex

Console.log your window.Web3auth.provider to make sure it’s valid, if it isn’t, then getSigner() won’t work.

You can follow the steps here in order to get the Web3Auth provider directly or you could get it from Moralis with a web3Auth provider.