Web3auth does not return user info

Please provide the following details too when asking for help in this category:

The problem is that web3Auth.getUserInfo() returns constantly null even after user has redirected to app.openlogin.com. Based on the code snippet below this results into a a constant loop. It redirects to app.openlogin.com then back to our app, and then the same loop again and again all because getUserInfo returns null.

  • SDK Version: 5.2.0
  • Browser Console Screenshots:

Please provide the Web3Auth initialization and login code snippet below:

const isConnected = async (self) => {
  try {
    const user = await self.web3Auth.getUserInfo();
    return Boolean(user)
  } catch(_) {
    return false
  }
}

const initWeb3Auth = async (self, dappShare) => {
  ...
  // check if user is already connected. If that's the case we don't have to call connectTo
  if (!await isConnected(self)) {
    // Connect auth 2.0 account with web3Auth
    await self.web3Auth.connectTo(WALLET_ADAPTERS.OPENLOGIN, {
      loginProvider: "jwt",
      extraLoginOptions: {
        id_token: await self.authProvider.getIdToken(),
        verifierIdField: "sub", // same as your JWT Verifier ID
        domain: self.web3AuthConfig.domain,
      },
    });
  }
}

UPDATE

We debugged the code and we found why it’s failing. More specifically, the following callback is called

    walletAdapter.on(ADAPTER_EVENTS.ERRORED, (data) => {
      this.status = ADAPTER_STATUS.ERRORED;
      this.clearCache();
      this.emit(ADAPTER_EVENTS.ERRORED, data);
      log.debug("errored", this.status, this.connectedAdapterName);
    });

And the error we see is Error: Internal JSON-RPC error.

This is why the getUserInfo is failing.

Can you guys please check if the nodes are healthy please?

It turns out it was an issue with the Solana RPC

1 Like